using namespace std;
int main()
{
int sumStore=0,num,rem,num1;
cout<<"Enter a number to Reverse it ";
cin>>num;
num1=num;
while(num>0)
{
rem=num%10;
//to store number
sumStore=(sumStore*10)+rem;
num=num/10;
}
cout<<"\nThe Reverse of "<<num1<<" is "<<sumStore<<endl;
return 0;
}
No comments:
Post a Comment