Advertisement
Josif_tepe

Untitled

May 7th, 2021
123
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.  
  3. using namespace std;
  4.  
  5. void zbir(int n) {
  6.     int suma = 0;
  7.     for(int i = 1; i <= n; i += 1) {
  8.         suma += i;
  9.     }
  10.     cout << suma << endl;
  11. }
  12.  
  13. int main() {
  14.     int n;
  15.     cin >> n;
  16.     zbir(n);
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement