C程序中的问题 [英] problem in C program
本文介绍了C程序中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对理解程序声明有疑问
声明
写一个程序,将2倍增加到50
我理解上面的声明表2程序表达到50
是我写的还是错的?
I have problem in understanding the program statement
statement
write a program that multiples 2 up to 50
I understand above statement that program of table of 2 up to 50
is I write or wrong?
推荐答案
我说你是对的:它要你提供输出的程序:
I'd say you are right: it wants you to provide a program that outputs:
1 * 2 = 2
2 * 2 = 4
...
24 * 2 = 48
25 * 2 = 50
你必须将2 * 2乘以50倍
步骤0:声明临时变量和temp = 1;
步骤1:运行步骤2 50次
步骤2:temp = temp * 2;
you have to multiply 2*2 upto 50 times
step 0 : declare a temp variable and temp=1;
step 1 : run step 2 for 50 times
step 2 : temp = temp * 2;
#include<stdio.h>
void main()
{
int temp=1,i;
for(i=1;i<=50;i++)
{
printf("%d",(temp*2));
}
}
这篇关于C程序中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文