#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int n;
cin >>n;
while(n%10==0){
n=n/10;
}
while(n>0){
cout <<n%10;
n=n/10;
}
return 0;
}
while(n%10==0){
n=n/10;
}
這段會有無盡迴圈的問題(若n=0),需要在迴圈內另外判斷n是否等於0,若是直接輸出0即可。