Brijmohan lal Sahu - Facebook
ads
ads

Thursday, October 30, 2014

Program to find reverse of any number using while loop


--------------------------------------------------------

// Program to find Reverse of any number//

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,n;
cout<<"\nEnter a number:";
cin>>n;
cout<<"\nYou entered: "<<n;
j=0;
while(n>0)
{
i=n%10;
j=j*10+i;
n=n/10;
}
cout<<"\nReverse of number is:"<<j;
getch();
}

No comments:

Post a Comment