题解 | #反向输出一个四位数#
反向输出一个四位数
https://www.nowcoder.com/practice/1f7c1d67446e4361bf4af67c08e0b8b0
#include <stdio.h> int main() { int num; scanf("%d",&num); int arr[4]; for (int i = 0; i < 4; i++) { arr[i] = num%10; //取个位数依次放入数组 num = num/10; //进位 } for (int j = 0; j < 4; j++) { //遍历数组 printf("%d",arr[j]); } printf("\n"); return 0; }