回复 2楼 jiangwu10057
能不能说明白点!我把我自己写的代码给你看看吧!
main()
{
long int x,a,b,c,d,e;
scanf("%ld",&x);
if(x<=99999&&x>9999)
{
printf("shi 5 wei shu\n");
a=x/10000;
printf("%1d",a);
b=x-a*10000;
b=b/1000;
printf(" %1d",b);
c=x-a*10000-b*1000;
c=c/100;
printf(" %1d",c);
d=x-a*10000-b*1000-c*100;
d=d/10;
printf(" %1d",d);
e=x-a*10000-b*1000-c*100-d*10;
printf(" %d\n",e);
printf("%ld",(e*10000+d*1000+c*100+b*10+a));
}
if(x<=9999&&x>999)
{
printf("shi 4 wei shu\n");
b=x/1000;
printf("%1d",b);
c=x-b*1000;
c=c/100;
printf(" %1d",c);
d=x-b*1000-c*100;
d=d/10;
printf(" %1d",d);
e=x-b*1000-c*100-d*10;
printf(" %d\n",e);
printf("%ld",(e*1000+d*100+c*10+b));
}
if(x<=999&&x>99)
{
printf("shi 3 wei shu\n");
c=x/100;
printf("%1d",c);
d=x-c*100;
d=d/10;
printf(" %1d",d);
e=x-c*100-d*10;
printf(" %d\n",e);
printf("%d",(e*100+d*10+c));
}
if(x<=99&&x>9)
{
printf("shi 2 wei shu\n");
d=x/10;
printf("%d",d);
e=x-d*10;
printf(" %d\n",e);
printf("%d",(e*10+d));
}
if(x<=9&&x>0)
{
printf("shi 1 wei shu\n");
printf("%d",e);
printf("%d",e);
}
getch();
}