SALUTARE !
Metoda 1 :
# include <bits/stdc++.h>
using namespace std;
int main ()
{
int n, s = 0;
cin >> n;
for (int i = 1; i <= n; ++i) {
s = s + i;
}
cout << s;
return 0;
}
Metoda 2 :
# include <bits/stdc++.h>
using namespace std;
int main ()
{
int n, s;
s = n * (n - 1) / 2;
cout << s;
return 0;
}