1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| # include <stdio.h> int main (void) { long int a,i=0,s[65]; printf("input a number:"); scanf("%ld",&a); while (a!=0) { if ( (a%10)%2 == 0 ) { s[i] = a%10; i++; } a = a/10; } printf("output:"); for ( i=i-1 ; i >= 0; i-- ) { printf("%ld",s[i]); } printf("\n"); return 0; }
|