题解 | 反向输出一个四位数
反向输出一个四位数
https://www.nowcoder.com/practice/1f7c1d67446e4361bf4af67c08e0b8b0
// #include <stdio.h>
// int main()
// {
// int num;
// scanf("%d",&num);
// int unit = num % 10;
// int ten = (num % 100) / 10;
// int hundred = (num % 1000) / 100;
// int thousand = num / 1000;
// printf("%d%d%d%d",unit,ten,hundred,thousand);
// return 0;
// }
#include <stdio.h>
int main()
{
int num;
scanf("%d",&num);
int i = 0;
while(num)
{
printf("%d",num%10);
num /= 10;
}
return 0;
}
查看8道真题和解析