#include
//无误及时采纳回答
int main()
{
int n;
int count=0,i,a[5];
printf ("输入一个不多于5位正整数(0~99999):\n");
scanf("%d",&n);
if (n<=0 || n>=100000)
{
printf ("输入的数不合法\n");
}
else
{
while(1)
{
a[count]=n%10;
n=n/10;
if(n==0)
{
break;
}
count++;
}
printf("位数:%d\n正序:",count+1);
for (i=count;i>=0;i--)
printf("%d ",a[i]);
printf("\n逆序:");
for (i=0;i<=count;i++)
printf("%d ",a[i]);
printf("\n");
}
return 0;
}