Advertisement
a53

cifparcifimp

a53
Dec 9th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int ncp,nci;
  4.  
  5. void nr_cif_pare_impare(int n)
  6. {
  7. if(n==0)
  8. ++ncp;
  9. else
  10. while(n)
  11. {
  12. if(n%2)
  13. ++nci;
  14. else
  15. ++ncp;
  16. n/=10;
  17. }
  18. }
  19.  
  20. int main()
  21. {
  22. int n;
  23. cin>>n;
  24. int x;
  25. while(n--)
  26. cin>>x,nr_cif_pare_impare(x);
  27. cout<<ncp<<' '<<nci<<'\n';
  28. return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement