Problem Description
输入一个三位的正整数,然后按数位的逆序输出这个数。注意:当输入的数字含有结尾的0时,输出不应带有前导的0,如输入700,输出应该是7。
Input Description
在一行中输入一个3位的正整数。
Output Description
在一行中按数位的逆序输出这个数。
Sample Input
123
Sample Output
321
代码实例
#include<stdio.h>
int main()
{
int num = 0;
scanf("%d", &num);
int a = 0;
int b = 0;
int c = 0;
int d = 0;
a = num % 10;
b = num / 10 % 10;
c = num / 100;
d = a * 100 + b * 10 + c;
printf("%d", d);
return 0;
}