#include <iostream>
using namespace std;
// 前n项(1 到 n)累加求和
void sum(int n)
{
int counts = 0;
for (int i = 1; i <= n; i++)
counts += i;
printf("前%d个数求和的结果是:%d
", n, counts);
}
int main()
{
int n;
cin >> n;
sum(n);
return 1;
}
#include <iostream>
using namespace std;
// 前n项(1 到 n)累加求和
void sum(int n)
{
int counts = 0;
for (int i = 1; i <= n; i++)
counts += i;
printf("前%d个数求和的结果是:%d
", n, counts);
}
int main()
{
int n;
cin >> n;
sum(n);
return 1;
}