fork download
  1. #include <stdio.h>
  2. #include<math.h>
  3. int main(void)
  4. {
  5. int a,c=0,d=0,e=0,b,f,i,q=0,g,h,k,temp=0;
  6. scanf("%d",&a);
  7. f=a;
  8. while(a!=0)
  9. {
  10. b=a%10;
  11. a=a/10;
  12. c++;
  13. if(b%2==0)
  14. {
  15. d++;
  16. temp=temp+b;
  17. temp*=10;
  18. }
  19. else
  20. {
  21. e++;
  22. temp2=temp+b;
  23. temp2*=10;
  24. }
  25. }
  26. printf("tot:%d\neven count:%d\nodd count:%d\n",c,d,e);
  27. printf("even:");
  28. temp=temp/10;
  29. for()
  30. printf("odd:");
  31.  
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0s 4408KB
stdin
4678
stdout
odd:7
tot:4
even count:3
odd count:1
even:4 6 8