#include <stdio.h>void main(){int n,s=0; scanf("%d",&n);do{s=s*10+n%10;n/=10;}while(n!=0);printf("%d\n",s);}
每次循环会取最后一位数然后乘10放到高位来实现逆序的效果