Advertisement
Guest User

Untitled

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