Tuesday, 7 March 2017

Geeksforgeeks Solution For " Reverse digit "

GeeksforGeeks Solution For School Domain .Below You Can Find The Solution Of Basic ,Easy ,Medium ,Hard .You Can Also Direct Submit Your Solution to Geeksforgeeks Same Problem .You Need to login then you can submit you answers 

Problem :- Write a program to reverse digits of a number.

Submit Your Solution :- Click Here 


Solution :-

#include <iostream>
using namespace std;

int main() 
{
int t;
cin>>t;
while(t--)
{
   int n,reverse=0,temp;
   cin>>n;
   //dig=log10(n);
   temp = n;

   while (temp != 0)
   {
      reverse = reverse * 10;
      reverse = reverse + temp%10;
      temp    = temp/10;
   }
    cout<<reverse<<endl;
}
return 0;
}

Output:-

Geeksforgeeks Solution For " Reverse digit "

No comments:
Write comments

Recommended Posts × +