0

Hi 8%5what the answer why?

14th Dec 2016, 6:45 PM
arixixs
4 Answers
+ 7
I won't give you the exact answer, but I'll explain how it works. % is called the modulus operator. It gives the remainder of the first value divided by the second value. So what is the remainder of 8 / 5? 5 goes into 8 however many times, and then what's left of 8?
14th Dec 2016, 6:50 PM
Tamra
Tamra - avatar
+ 3
The answer is 3. 8 divided by 5 is 1. with a remainder of 3. So the output of your code is 3.
14th Dec 2016, 7:12 PM
Thomas Kutzner
Thomas Kutzner - avatar
+ 3
See my "% Modulus explained" code to understand in a way, you may have learnt at school https://code.sololearn.com/c2fRl6x893E7/?ref=app
31st Dec 2016, 12:48 PM
Vishal++
Vishal++ - avatar
+ 2
simply it returns remainder ..
14th Dec 2016, 7:52 PM
Exception Handler
Exception Handler - avatar