Advertisement
Guest User

Untitled

a guest
May 5th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7. //Unos broja brojeva te nakon toga nakon svakog unosa ispisuje sumu i broj negativnih do tad
  8. int brojUnosa=0;
  9. int unesenBroj=0;
  10. int suma=0;
  11. int brojNegativnih=0;
  12.  
  13. cout<<"Unesi broj unosa: "<<endl;
  14. cin>>brojUnosa;
  15.  
  16. for(int brojac=0; brojac<brojUnosa;brojac++){
  17. cout<<"Unesite broj: "<<endl;
  18. cin>>unesenBroj;
  19. if(unesenBroj%2 !=0){
  20. brojNegativnih++;
  21. }
  22.  
  23. suma+=unesenBroj;
  24. cout<<"Suma je: "<<suma<<endl;
  25. cout<<"Broj negativnih: "<<brojNegativnih<<endl;
  26.  
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33. system("pause");
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement