注册 登录
编程论坛 C++教室

为什么不能出结果,求解释!!!!

wushengyao 发布于 2012-10-29 21:54, 337 次点击
#include "stdio.h"
main()
{
   int i=1,s=0;
   while (i<=10)
       s+=i;
       i++;
   printf("%d\n",s);

}

结果
4 回复
#2
TonyDeng2012-10-29 21:54
好好看书!
#3
小小小火柴2012-10-29 21:57

#include "stdio.h"
main()
{
   int i=1,s=0;
   while (i<=10)
   {   s+=i;
       i++;
   }
   printf("%d\n",s);

}
你的while语句没有用{}括起来!
#4
wushengyao2012-10-30 12:39
嗯!小问题,谢了啊。
#5
okauld2012-11-02 09:30
括号。。
1