杭电oj 1001
作者:互联网
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){}
标签:oj,int,sum,cin,杭电,while,审题,1001,cout 来源: https://www.cnblogs.com/Amarantos475/p/15269822.html