Who would know that integers don’t round? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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. :)

11th Jun 2018, 4:59 PM
Sullivan Manning
Sullivan Manning - avatar
2 Answers
+ 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.
11th Jun 2018, 5:19 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
I underdstood it before, but the program never explained it. Thankyou for the explanation though, much appreciated!
11th Jun 2018, 5:21 PM
Sullivan Manning
Sullivan Manning - avatar