初学者编译时出错,求教
编译了一个程序,求s=1+(1+2)+(1+2+3)+...+(1+2+3+4+...+n)的值#include <stdio.h>
main()
{
int n, i=1, a=0, s=0;
scanf("%d\n",&n);
while(i<=n)
{
a=a+i;
s=s+a;
i++;
}
printf("%d\n",s);
}
先上来编译通过,可以输入n的值,然后就没反应了呢?不明白,还望指教
2012-05-08 10:46
2012-05-08 11:00
2012-05-08 11:10
2012-05-08 12:44
2012-05-08 12:48
2012-05-08 15:18
2012-05-08 17:54
2012-05-08 18:35
2012-05-11 12:53