Reputation: 55
With the function:
int five(int n)
{
if ((n%5)==0)
return 1;
else
return 0;
}
Why are the limitations of this positive numbers only even if there is no remainder?
Upvotes: 0
Views: 125
Reputation: 212248
for n == -2, some hardware will compute n%5
as 3, while other hardware evaluates it as 2. To accommodate that , the standard leaves %
ambiguous for negative values.
Upvotes: 2