2021-10-25
作者:互联网
#include<stdio.h>
int main()
{
int a,b,c,d,e,f,g,x,z;
scanf("%d",&x);
if((x<0)||x>1000000)
return 0;
a=x/1000000%10;
b=x/100000%10;
c=x/10000%10;
d=x/1000%10;
e=x/100%10;
f=x/10%10;
g=x%10;
if(a%2==0)
{a=0 ;
}
else{
a=1;}
if(b%2==0)
{b=1 ;
}
else{
b=0;}
if(c%2==0)
{c=0 ;
}
else{
c=1;}
if(e%2==0)
{e=0 ;
}
else{
e=1;}
if(g%2==0)
{g=0 ;
}
else{
g=1;}
if(d%2==0)
{d=1 ;
}
else{
d=0;}
if(f%2==0)
{f=1 ;
}
else{
f=0;}
z=a*64+b*32+c*16+d*8+e*4+f*2+g*1;
printf("%d",z);
return 0;
}
标签:10,return,25,int,d%,else,2021,b% 来源: https://blog.csdn.net/weixin_44307871/article/details/120952193