Advertisement
Josif_tepe

Untitled

Apr 3rd, 2024
707
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. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int zbir(int n) {
  7.     int sum = 0;
  8.     for(int i = 0; i  <n; i++) {
  9.         sum += i;
  10.     }
  11.     return sum;
  12. }
  13. int main() {
  14.     cout << zbir(10) << endl;
  15.     return 0;
  16. }
  17.  
  18. // 1 1 2 3 5 8 13
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement