WAP to find the reverse number in c++;


Write c++ code to reverse number.
 WAP to find the reverse number in c++.
Write a c++ code to find reverse number without using loop.

 
#include<iostream>
void main()
{
int n, d1, d2, d3, d4, d5, sum;
cout<<"Enter a five digit number : ";
cin>>n;
d1=n%10;
n=n/10;
d2=n%10;
n=n/10;
d3=n%10;
n=n/10;
d4=n%10;
n=n/10;
d5=n%10;
cout<<"The entered number in reverse order is : "<<d1<<d2<<d3<<d4<<d5;
}

output-:
Enter a five digit number : 90225
The entered number in reverse order is :52209






No comments:

Post a Comment