#include <iostream>
using namespace std;
class ReverseNo
{
int n;
public:
void get(int m)
{
n=m;
}
void reverse()
{
int d,revno=0;
cout<<"\n given no is: "<< n;
while(n>0)
{
d=n%10;
revno=revno*10+d;
n=n/10;
}
cout<<"\n reverse no is : "<< revno;
}
};
int main()
{
cout<<"Finding reverse no O-O program";
ReverseNo N1,N2;
N1.get(12345);
N1.reverse();
N2.get(22222);
N2.reverse();
return 0;
}
output:
Finding reverse no O-O program
given no is: 12345
reverse no is : 54321
given no is: 22222
reverse no is : 22222
0 Comments
Post a Comment