include
using namespace std;
int main()
{
int n, sum, i;
while(cin >> n )
{
sum=0;
for(i=1;i<=n;i++){
sum+=i;
}
cout << sum << endl;
cout << endl;
}
return 0;
}
注意审题,题目要求输出后空一行。教训,反复错题找不到需再次审题。
循环输入
c++ while(cin>>a[i]){}
c while(scanf("%d",&a)!=EOF){}