/* 输入一个五位以内的正整数,(1)判断它是一个几位数;(2)请按序输出其各位数字;(3)逆序输出其各位数字。
如输入:56439,输出:5位数
5,6,4,3,9
9,3,4,6,5
*/
1#include<stdio.h>
2
3 int a[5],b[5];
4 void display(int i)
5 {printf("the positive sort is:");
6 int j=0;
7 for(j=i;j>0;j--)
8 printf("%d",a[j-1]);
9 printf("\n");
10 printf("the negative sort is:");
11 for(j=0;j<i;j++)
12 printf("%d",a[j]);
13 printf("\n");
14
15 }
16
17 void main()
18 {
19 int num;
20 printf("input your number:");
21 scanf("%d",&num);
22 if(num<0||num>99999) {printf("error!\n");}
23 else{
24 a[4]=num/10000;b[2]=num%10000;
25 a[3]=b[2]/1000;b[1]=b[2]%1000;