输入12345
输出1 2 3 4 5(正序)
(逆序5 4 3 2 1)
#include<stdio.h>
#include <stdlib.h>
#define N 30
int main(void)
{
long int n;
int m = 0,i=0;
int s[N] = {0};
scanf("%ld", &n);
//printf("%ld\n", n);
m = n % 10;
n =n/10;
s[0] = m;
while(n!=0){
i++;
m = n % 10;
n =n/10;
s[i] = m;
}
for (int j = i; j >0;j–) //for 循环输出,如逆序输出j=0;j<I;j++
{
printf("%d “, s[j]);
}
printf(”%d", s[0]);
return 0;
}