#include<iostream.h>
#include<conio.h>
void main()
{
int a,aa; // inputs the number
cin>>a;aa=a; // save the value for other code
// we do this as simple way first way
int b,c,d,e,f;
b=a%10;a=a/10;c=a%10;a=a/10;d=a%10;a=a/10;e=a%10;a=a/10;f=a;
cout<<"This is the reverse order: "<<b<<c<<d<<e<<f<<endl;
// by effienct way use any digit number
b=0;
cout<<"\nThis is also the reverse order: "<<endl<<endl;
do
{
b=aa%10;
cout<<b;
aa/=10;
}while(aa>0);
cout<<endl;
}
No comments:
Post a Comment
Comments please: