题解 | 反向输出一个四位数
反向输出一个四位数
https://www.nowcoder.com/practice/1f7c1d67446e4361bf4af67c08e0b8b0
#include <stdio.h>
int main() {
int n=0,rev=0;
scanf("%d",&n);
// for(int i=0;i<4;i++)
// {
// printf("%d",n%10);
// n/=10;
// }
//升级版
// 处理所有位数,直到n变为0
while(n != 0) {
printf("%d", n % 10);
n /= 10;
}
printf("\n");
return 0;
}