Advertisement
Josif_tepe

Untitled

Apr 23rd, 2021
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int zbir(int N) {
  5.     int sum = 0;
  6.     for(int i = 1; i <= N; i += 1) {
  7.         sum += i;
  8.     }
  9.     return sum;
  10. }
  11. int main() {
  12.     int n;
  13.     cin >> n;
  14.     cout << zbir(n) << endl;
  15.  
  16.     return 0;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement