josiftepe

Untitled

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