程序每次读入一个正3位数,然后输出按位逆序的数字。注意:当输入的数字含有结尾的0时,输出不应带有前导的0。比如输入700,输出应该是7。
每个测试是一个3位的正整数。
输出按位逆序的数。
#include
int main()
{
int x;
scanf("%d", &x);
int y;
int z = 0;
while (x > 0)
{
y = x % 10;
z = z * 10 + y;
x /= 10;
}
printf("%d", z);
return 0;
}
123
321