int main()
My code works fine...i will be using const later ,hence my variable are capital letters.What i need a little help is when the NUM_VALUE is negative.If i am not wrong its call integer division error.(where one or more operand is negative.How can i avoild this?
I inserted under do
if(NUM_VALUE < 0)
NUM_VALUE = -NUM_VALUE;
cout<< NUM_VALUE;
but it doesnt seem to work.Any ideas?
int main()
{
long NUM_VALUE;
cout << "Enter any integer number" << "\n";
cin >> NUM_VALUE;
do
{
long REVERSE=0;
REVERSE = REVERSE*10+ NUM_VALUE % 10;
cout<< REVERSE;
NUM_VALUE = NUM_VALUE / 10;
}
while (NUM_VALUE != 0);
cout<<"\n";
return(0);
}