#include<stdio.h>
int main()
{
int n,a,b,c,d,e,num = 0;
int ret;
while(1)
{
printf("请输入不超过无五位的正整数:\n");
ret = scanf("%d",&num);
fflush(stdin);
if(num<0 || num>100000)
{
printf("输入有误!");
continue;
}
if(ret ==1)break;
}
if(num>10000) n = 5;
else if(num>1000) n = 4;
else if(num>100) n = 3;
else if(num>10) n = 2;
else if(num>0) n = 1;
a = num%10;
b = num/10%10;
c = num/100%10;
d = num/1000%10;
e = num/10000;
printf("这是个%d位数\n",n);
printf("这个原数为%d\n",num);
switch(n)
{
case 5:
printf("逆序输出为:%d,%d,%d,%d,%d\n",a,b,c,d,e);break;
case 4:
printf("逆序输出为:%d,%d,%d,%d\n",a,b,c,d);break;
case 3:
printf("逆序输出为:%d,%d,%d\n",a,b,c);break;
case 2:
printf("逆序输出为:%d,%d\n",a,b);break;
case 1:
printf("逆序输出为:%d\n",a);break;
}
}