SHARE
TWEET

Untitled

a guest Feb 21st, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top