PSEUDOCOD:
start
natural n, d
citeste n
s <-- n * (n + 1) div 2;
scrie s
stop
C++:
# include <bits/stdc++.h>
using namespace std;
int main ()
int n, s;
cin >> n;
s = n * (n + 1) / 2;
cout << s;
return 0;
}
EXPLICATIE:
n - numarul de borcane
s - suma lor