C++ Program to Reverse number

ad+1

Program:

// Program By http://solutionscpp.blogspot.com
// Author Mansoor Ahmed
// GMail ID: secguy000@gmail.com

#include <iostream>
using namespace std;

int main() {

   int num=0, rev=0, temp=0;
  
   cout<<"Enter Number: ";
   cin>>num;
  
   while(num!=0)
   {
      
       temp=num%10;
       rev=(rev*10)+temp;
       num=num/10;
   }
  
   cout<<"Reversed Number is " <<rev;

  return 0;
 
}

Output:

1 comment: Leave Your Comments