#include<iostream.h>
#include<conio.h>
int Reverse(int num);
void main()
{
clrscr();
int n, r;
cout<<"Enter a number: ";
cin>>n;
r = Reverse(n);
cout<<"The reverse number is : "<<r;
getch();
}
int Reverse(int num)
{
int rev_num = 0;
while(num > 0)
{
rev_num = rev_num * 10 + num % 10;
num = num / 10;
}
return rev_num;
}
#include<conio.h>
int Reverse(int num);
void main()
{
clrscr();
int n, r;
cout<<"Enter a number: ";
cin>>n;
r = Reverse(n);
cout<<"The reverse number is : "<<r;
getch();
}
int Reverse(int num)
{
int rev_num = 0;
while(num > 0)
{
rev_num = rev_num * 10 + num % 10;
num = num / 10;
}
return rev_num;
}
0 comments:
Post a Comment