一个简单的C程序99999999
来源:百度知道 编辑:UC知道 时间:2024/06/22 16:37:34
#include<math.h>
main()
{int a,i,t;
a=1
(i=1,i<=5,i++)
t=i*a;
printf("%d"t);
}
我要知道哪错了给我只出就行了
#include <stdio.h>
#include<math.h>
main()
{int a,i,t;
a=1;
for (i=1;i<=5;i++)
{
t=i*a;
printf("%d",t);
}
}
为什么最后是12345呀我要求它是1*2*3*4*5
main()
{int a,i,t;
a=1
(i=1,i<=5,i++)
t=i*a;
printf("%d"t);
}
我要知道哪错了给我只出就行了
#include <stdio.h>
#include<math.h>
main()
{int a,i,t;
a=1;
for (i=1;i<=5;i++)
{
t=i*a;
printf("%d",t);
}
}
为什么最后是12345呀我要求它是1*2*3*4*5
原来如此,和我猜的一样,程序如下,实现5!
/////////////////////////////////////////
#include <stdio.h>
#include<math.h>
main()
{int i,t=1;
for (i=1;i<=5;i++)
t*=i;
printf("%d",t);
}
#include <stdio.h>
#include<math.h>
main()
{int a,i,t;
a=1;
for (i=1;i<=5;i++)
{
t=i*a;
}
printf("%d",t);
}
这样应该对了吧
#include <stdio.h>
void main()
{int a,i,t;
a=1;
for (i=1;i<=5;i++)
{
t=i*a;
printf("%d ",t);
}
}
根本不需要a这个变量,把a的定义去掉,再把所有的a改成t就行了。
错了3个地方:
1、a = 1;//没有加分号
2、for(i=1;i<=5;i++)//没有for关键字,而且不用用逗号
3、printf("%d",t);//两个参数之间要用逗号分割
a=1
(i=1,i<=5,i++)
printf(“%d”t);
以上错了