Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. #include <fstream>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int n,impare=0, pare=0, v[100];
  10. cin>>n;
  11. for(int i=0; i<n; i++)
  12. {
  13. cin>>v[i];
  14. }
  15. for(int i=0; i<n; i++)
  16. {
  17. if(v[i]%2==0)
  18. impare++;
  19. if(v[i]%2==1)
  20. pare++;
  21. }
  22. if(impare>pare)
  23. cout<<impare-pare;
  24. else
  25. cout<<pare-impare;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement