WAP to reverse a number.




           #include<iostream.h>
           #include<conio.h>
                     int main()
               {
                     int v, reverse = 0;
               cout<<”Enter a number to reverse \n”;
               cin>>v;
               while (v !=0)
                {
                      reverse = reverse *10;
                      reverse = reverse + v%10;
                      v =n\10;
                }
               cout<<” Reverse of entered number is =”<< reverse<<”\n”;
                      return 0;
                }


Output:-


Comments