I am getting differing opinions on the answer to 1%2. Some say you should round and the answer is 1 and some say the answer is 0 because modulus only deals with integer values in C++. I used a sample program to test this in the compiler and it seems to be rounding the answer because it says the value is 1.
Anyone out there have insight and can help us settle this? .
a%b behaves like follows (i consider a and b to be greater than 0) :
Compose a into a = k*b + rest, where k - the largets integer that can appear here. The rest is the answer (it will be strictly less than b and greater or equal 0).