![]() |
reversing input numbers
Hi came up with his code, basically to reverse whatever input you key in. However when i key in 0 or 0001 or -101 they donot reverse.What have i done wrong and how to correct?
Code:
#include <iostream> |
Re: reversing input numbers
Mmmmmm it could be because i am using %modulus so if that is the case, should i re-frame from using modulus for negative numbers?How about 0s? any help?
|
Re: reversing input numbers
i think in all likelihood because of integer.
|
Re: reversing input numbers
Quote:
The C90 standard does not define the result of modulus applied on negative numbers, so the result is compiler dependant. |
| All times are GMT +5.5. The time now is 07:40. |