Skip to main content

Reverse a Number

 /* @ToDo 


   Reverse a Number
   7325 => 5237
   12345 => 54321

*/


#include <iostream>
using namespace std;

int main(){
     #ifndef ONLINE_JUDGE
        freopen("../asset/input.txt","r",stdin);
        freopen("../asset/output.txt","w",stdout);
    #endif
    // Code here!!

    int ncin>>n;
    int num = 0;
    while(n>0){
        num = (num*10) + (n%10);
        n /= 10;
    }
     cout<<num<<endl;
    return 0;
}

Comments

Subscribe to Get's Answer by Email