#include<iostream>
using namespace std;
int main()
{
int n = 0, sum;
while (cin>>n)
{
sum = 0; // 这里要清零
for (int i =0; i <= n; i++)
{
sum += i;
}
cout << sum <<endl <<endl;
}
return 0;
}
杭电oj 1001
时间: 2024-08-12 05:37:20
#include<iostream>
using namespace std;
int main()
{
int n = 0, sum;
while (cin>>n)
{
sum = 0; // 这里要清零
for (int i =0; i <= n; i++)
{
sum += i;
}
cout << sum <<endl <<endl;
}
return 0;
}
杭电oj 1001