#include<cstdio>
int main ()
{
int s,c;
scanf("%d",&a);
int b=0;
do{
b++;
c=c+b;
}while(b<a)
printf("%d",c)
return 0;
}
信息:
E:\xxxx\xxxx\xxxx\xxxx In function 'int main()':
515E:\xxxx\xxxx\xxxx\xxxx 计算s=1+2+3+……+n.cpp[Error] 'a' was not declared in this scope
113E:\xxxx\xxxx\xxxx\xxxx [Error] expected ';' before 'printf'
122E:\xxxx\xxxx\xxxx\xxxx [Error] expected ';' before 'return'
还没有评论,快来发表第一个评论!