0
Who would know that integers don’t round?
It was never explained, I don’t believe, that integers don’t round and that you only take the int answer and leave the remainder. Should be explained better! I still love this program though. :)
2 Antworten
+ 4
Depends on the language. In Python, for instance, the division between two integer values (I assume this is the case here) would result in a floating-point value.
3/2 is 1.5
In other cases, there are also a lot of justified reasons why the division between two integer values should result in the floored integer value (i.e. 3 / 2 is 1 instead of the rounded 2), part of which is that you can retrieve the remainder using the modulus operator %.
Hence, 3 divided by 2 is (3/2) with remainder of (3%2).
Now it all makes more sense, does it?
*Note: Floor division is still possible with Python. Instead of /, we use // there. However, this seems to be out of scope of this thread.
+ 2
I underdstood it before, but the program never explained it. Thankyou for the explanation though, much appreciated!