int i,a,b,c,d,e;
scanf("%d",&i);
if(i>99999)
printf("输入错误");
else if(i>9999)
{a=i/10000;
b=(i-a*10000)/1000;
c=(i-a*10000-b*1000)/100;
d=(i-a*10000-b*1000-c*100)/10;
e=i-a*10000-b*1000-c*100-d*10;
printf("位数:%d,分开:%d,%d,%d,%d,%d,逆向输出:%d%d%d%d%d",5,b,c,d,e,e,d,c,b,a);
}
else if(i>999)
{a=i/10000;
b=(i-a*10000)/1000;
c=(i-a*10000-b*1000)/100;
d=(i-a*10000-b*1000-c*100)/10;
e=i-a*10000-b*1000-c*100-d*10;
printf("位数:%d,分开:%d,%d,%d,%d,逆向输出:%d%d%d%d",4,b,c,d,e,e,d,c,b);
}else if(i>99)
{a=i/10000;
b=(i-a*10000)/1000;
c=(i-a*10000-b*1000)/100;
d=(i-a*10000-b*1000-c*100)/10;
e=i-a*10000-b*1000-c*100-d*10;
printf("位数:%d,分开:%d,%d,%d,逆向输出:%d%d%d",3,c,d,e,e,d,c);
}else if(i>9)
{a=i/10000;
b=(i-a*10000)/1000;
c=(i-a*10000-b*1000)/100;
d=(i-a*10000-b*1000-c*100)/10;
e=i-a*10000-b*1000-c*100-d*10;
printf("位数:%d,分开:%d,%d,逆向输出:%d%d",2,d,e,e,d);}
else printf("位数:%d,分开:%d,逆向输出:%d",1,i,i);
[
本帖最后由 hjywyj 于 2011-4-10 13:17 编辑 ]