AcWing每日一题--数字反转

https://www.acwing.com/problem/content/447/

水题。

 1 #include<iostream>
 2 using namespace std;
 3 int main(void){
 4     int n;
 5     cin>>n;
 6     int res=0;
 7     while(n){
 8         int t=n%10;
 9         n/=10;
10         res=res*10+t;
11     }
12     cout<<res;
13     return 0;
14 }

 

posted on 2021-02-16 19:35  greenofyu  阅读(13)  评论(0编辑  收藏  举报