#include <stdio.h>
int main()
{
int m, a, b, c, d, e,i=0;
scanf_s("%d", &m);
a = (int)(m / 10000);
b = (int)((m - a * 10000) / 1000);
c = (int)((m - a * 10000-b*1000) / 100);
d = (int)((m - a * 10000 - b * 1000-c*100) / 10);
e = (int)((m - a * 10000 - b * 1000 - c * 100-d*10));
printf("%d 每一位对应的数字为%d %d %d %d %d\n",m,a,b,c,d,e);
if (a != 0 )
printf("%d是五位数\n", m);
else if (a == 0 && b != 0)
printf("%d是四位数\n", m);
else if (a == 0 && b == 0&&c!=0)
printf("%d是三位数\n", m);
else if (a == 0 && b == 0 && c == 0&&d!=0)
printf("%d是两位数\n", m);
else
printf("%d是一位数\n", m);
for (; m > 0; m=m / 10)
{
i = i * 10 + m % 10;
}
printf("按逆序排列是%d\n",i);
return 0;
}
标签:10,正整数,int,else,几位数,&&,printf,10000,逆序 From: https://blog.51cto.com/u_16336886/8285657