i want to make a var equals the revers of the digit's of another var .
suppose that we have two integers (x , y) .. x=123 we want to set y to be y=321 .
what should we do ??
# include <iostream>
usingnamespace std;
int main(){
int number, reverse=0;
cout<<"Input a Number and press enter to reverse:\t";
cin>> number;
for(; number!=0;)
{
reverse=reverse*10;
reverse=reverse+number%10;
number=number/10;
}
cout<<"New reversed number is:\t\t"<<reverse;
return 0;
}