C++ program to find the reverse of a number.



#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
intr,n,rev=0;
cout<<"enter any no.=";
cin>>n;
do
 {r=n%10;
rev=10*rev+r;
 n=n/10;
 }
while(n!=0);
cout<<"reverse no. is="<<rev;
getch();
 }

OUTPUT
enter any no.=54

reverse no. is=45

Comments :

Post a Comment