Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int a, cons, pros, zeros, n;
  7. cin >> a;
  8. for (int i = 0; i < a; i++){
  9. cin >> n;
  10. if (n > 0){
  11. pros = 0;
  12. pros = pros + 1;
  13. }
  14. else if (n < 0){
  15. cons = 0;
  16. cons = cons + 1;
  17. }
  18. else{
  19. zeros = 0;
  20. zeros++;
  21. };
  22. };
  23.  
  24. cout << "pros: "<< pros<< " "<< "cons: "<< cons<< " "<< "zeros: "<< zeros<< " ";
  25. return 0;
  26. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement