Advertisement
Josif_tepe

Untitled

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