Navigation Bar

Transpose the value by using while loop



#include<conio.h>
#include<iostream.h>
void main()
{

clrscr();
int n,a;
cout<<"Enter number: ";
cin>>n;
cout<<”Transpose of number is: ”;
while (n>0)
{
a=n%10;
n=n/10;
cout<<a;
}
getch();
}

Output


Enter number: 7890
Transpose of number is: 0987

No comments:

Post a Comment