我照这写的c语言不能运行
#include <stdio.h>
main()
{
int x,s;
scanf("%d",&x);
s=x*x*x;
printf("x*x*x=%s
",s);
}
你的输出语句应改为:printf("x*x*x=%d ",s);
解析:因为s是整型变量,其输出格式符要用 %d 。这样,程序将会正确输出,如输入为2时的输出结果:
热门标签:
#include <stdio.h>
main()
{
int x,s;
scanf("%d",&x);
s=x*x*x;
printf("x*x*x=%s
",s);
}
你的输出语句应改为:printf("x*x*x=%d ",s);
解析:因为s是整型变量,其输出格式符要用 %d 。这样,程序将会正确输出,如输入为2时的输出结果: