题解 | #反向输出一个四位数#
反向输出一个四位数
https://www.nowcoder.com/practice/1f7c1d67446e4361bf4af67c08e0b8b0
#include <math.h>
#include <stdio.h>
int main() {
int a;
scanf("%d",&a);
/*int b,c,d,e;
b=a/1000;
c=(a%1000)/100;
d=(a%100)/10;
e=a%10;
printf("%d%d%d%d",e,d,c,b);*/
while ((a)) {
printf("%d",a%10);
a=a/10;
}
return 0;
}
两种解法,很神奇

查看16道真题和解析