回复 8楼 zzgzzg00


[ 本帖最后由 freezesoul 于 2010-11-11 17:02 编辑 ]
#include<stdio.h> void main() { int a,gw,sw,bw,qw,ww,i; scanf("%d",&a); gw=a%10; sw=a/10%10; bw=a/100%10; qw=a/1000%10; ww=a/10000; if(gw!=0) i=1; if(sw!=0) i=2; if(bw!=0) i=3; if(qw!=0) i=4; if(ww!=0) i=5; switch(i) { case 1: printf("是1位数:%d\n",gw); printf("它的逆序为:%d\n",gw);break; case 2: printf("是2位数:%d %d\n",sw,gw); printf("它的逆序为:%d %d\n",gw,sw);break; case 3: printf("是3位数:%d %d %d\n",bw,sw,gw); printf("它的逆序为::%d %d %d\n",gw,sw,bw);break; case 4: printf("是4位数:%d %d %d %d\n",qw,bw,sw,gw); printf("它的逆序为:%d %d %d %d\n",gw,sw,bw,qw);break; case 5: printf("是5位数:%d %d %d %d %d\n",ww,qw,bw,sw,gw); printf("它的逆序为:%d %d %d %d %d\n",gw,sw,bw,qw,ww);break; default:putchar('\a'); } }这 是对3楼的修改