Josif_tepe

Untitled

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