BUPT-homework/semester1/pset5/1-numbers.c

26 lines
345 B
C
Raw Normal View History

2021-10-25 20:25:25 +08:00
#include <stdio.h>
int main(void) {
// To store answer
int nums[10];
long long n;
int i = 0;
scanf("%lld", &n);
while (n > 0) {
nums[i] = n % 10;
n /= 10;
i++;
}
for (int j = i - 1; j >= 0; j--) {
if (j == 0) {
printf("%i\n", nums[j]);
} else {
printf("%i ", nums[j]);
}
}
return 0;
}