做题目时发现了一个比较好的c语言程序
#include<stdio.h>
int main()
{
int a,b,c,d,e;
int num,n;
int p;
printf(“请输入一个0~99999的正整数:”);
scanf("%d",&num);
if(num>99999&&num<0)
printf(“输入错误”);
else if(num>9999) n=5;
else if(num>999) n=4;
else if(num>99) n=3;
else if(num>9) n=2;
else if(num>0) n=1;
printf("\n输入的数字是%d位数\n",n);
a=num/10000;
b=(num-a10000)/1000;
c=(num-a10000-b1000)/100;
d=(num-a10000-b1000-c100)/10;
e=(num-a10000-b1000-c100-d10);
printf(“每一位数字为:%d,%d,%d,%d,%d\n”,a,b,c,d,e);
printf(“逆序为:%d%d%d%d%d\n”,e,d,c,b,a);
return 0;
}
09-10