#32327: c++解


yp11051259@yphs.tp.edu.tw (906-45 蔡尚恩)

學校 : 臺北市私立延平高級中學
編號 : 159733
來源 : [203.72.178.2]
最後登入時間 :
2024-01-02 09:20:42

#include<iostream>
using namespace std;

int main(){
    int a, t;    //a=>輸入的數 
    while(cin>>a){
        bool Front=true;    //宣告來判斷開頭是否為0 
        if(a==0) cout<<0;    //a==0
        while(a){    //a==0 => 已經翻轉完畢 
            t=a%10;    //取a的餘數 
            if(Front!=true||t!=0){    //若 
                Front=false;    //有不是0的數 
                cout<<t;
            } 
            a/=10;
        }    
        cout<<"\n";
    }
    return 0;
}