#include<stdio.h> int main(){ int n; int result=0; scanf("%d",&n); result=fun(n); printf("%d",result); } int fun(int n){ int d,e=1,m=0; while(n!=0){ d=n%10; if(d%2==0){ m=d*e+m; e=e*10; } n=n/10; } return m; }
时间: 2024-10-12 09:04:39
#include<stdio.h> int main(){ int n; int result=0; scanf("%d",&n); result=fun(n); printf("%d",result); } int fun(int n){ int d,e=1,m=0; while(n!=0){ d=n%10; if(d%2==0){ m=d*e+m; e=e*10; } n=n/10; } return m; }