Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n=0;
- int hold;
- int count0 =0, count1 =0, count2 =0, count3 =0, count4 =0, count5 =0, count6 =0, count7 =0, count8 =0, count9 =0;
- while(n == 0){
- printf("n=");
- scanf("%d", &n);
- }
- while(n != 0){
- hold = n%10;
- n /=10;
- switch(hold){
- case 0:
- count0++;
- break;
- case 1:
- count1++;
- break;
- case 2:
- count2++;
- break;
- case 3:
- count3++;
- break;
- case 4:
- count4++;
- break;
- case 5:
- count5++;
- break;
- case 6:
- count6++;
- break;
- case 7:
- count7++;
- break;
- case 8:
- count8++;
- break;
- case 9:
- count9++;
- break;
- }
- }
- if(count0 % 2 == 0 && count0 != 0){
- printf("0 ");
- }
- if(count1 % 2 == 0 && count1 != 0){
- printf("1 ");
- }
- if(count2 % 2 == 0 && count2 != 0){
- printf("2 ");
- }
- if(count3 % 2 == 0 && count3 != 0){
- printf("3 ");
- }
- if(count4 % 2 == 0 && count4 != 0){
- printf("4 ");
- }
- if(count5 % 2 == 0 && count5 != 0){
- printf("5 ");
- }
- if(count6 % 2 == 0 && count6 != 0){
- printf("6 ");
- }
- if(count7 % 2 == 0 && count7 != 0){
- printf("7 ");
- }
- if(count8 % 2 == 0 && count8 != 0){
- printf("8 ");
- }
- if(count9 % 2 == 0 && count9 != 0){
- printf("9 ");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement