Advertisement
Josif_tepe

Untitled

Nov 26th, 2023
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.     int n;
  10.     cin >> n;
  11.     int sum = 0;
  12.     int brojac = 1;
  13.    
  14.     while(brojac <= n) {
  15.         int x;
  16.         cin >> x;
  17.        
  18.         sum += x;
  19.         brojac++;
  20.     }
  21.    
  22.     cout << sum << endl;
  23.    
  24.  
  25.    
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement