#include<stdio.h>
main()
{
int g,s,b;
int x,y;
printf("请输入一个三位数");
scanf("%d",&x);
g=x%10;
s=(x-s*100)/10;
b=x/100;
y=g*100+s*10+b;
printf("三位数x=%d的逆序数%d\n",x,y);
return 0;
}
结果图片:
#include<stdio.h>
main()
{
int g,s,b;
int x,y;
printf("请输入一个三位数");
scanf("%d",&x);
g=x%10;
s=(x-s*100)/10;
b=x/100;
y=g*100+s*10+b;
printf("三位数x=%d的逆序数%d\n",x,y);
return 0;
}
结果图片: