标题: 各位大哥,帮帮小弟,为什么会出现这样的结果。 (还是C语言) [打印本页] 作者: 东方未明 时间: 2004-04-19 22:13 标题: 各位大哥,帮帮小弟,为什么会出现这样的结果。 (还是C语言) 我想编写一个打印出1~10之间的所有整数。
第一个程序:
/* processing one to ten number test program */
#include<stdio.h>;
main ()
{
int x =0, total =0;
while (++x <= 10)
{
total +=x;
printf ("%d\t",total);
}
}
编译出来的结果不正确,从第三个数字开始都是成22拉。
我有把程序改了
/* processing one to ten number test program */
#include<stdio.h>;