Josif_tepe

Untitled

Nov 22nd, 2025
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4.    
  5.     int n;
  6.     cin >> n;
  7.    
  8.     int zbir = 0;
  9.     int i = 1;
  10.    
  11.     while(i <= n) {
  12.         zbir += i; // zbir = zbir + i;
  13.         i++;
  14.     }
  15.    
  16.     cout << zbir << endl;
  17.    
  18.     return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment