MODULO (%) problems in C++!!!!

Status
Not open for further replies.
I think you misunderstand what the modulo does. Modulo evaluates the following: a % b = c => b*k + c = a. Where we find some integer k that satisfies that relation. In the case of non-negative integers this is the same as the remainder of dividing a and b. The remainder is 2 in your case, since 18 % 8 = 2 => 8*2 + 2 = 18. Not .25, which is 2 / 8. Or, IOW, the remainder divided by the dividend.
 
Status
Not open for further replies.