Wanted to find out what happens the numerator is smaller than the denominator for instance 4%8? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Wanted to find out what happens the numerator is smaller than the denominator for instance 4%8?

Modulus operator

22nd Jan 2019, 11:11 PM
TUMAINI BENJAMIN EMMANUEL
TUMAINI BENJAMIN EMMANUEL - avatar
4 Answers
+ 4
You can use the code playground. The result will always the same as the numerator. 4%8 = 4 1%7 = 1 https://stackoverflow.com/questions/3622298/how-does-modulus-of-a-smaller-dividend-and-larger-divisor-work
22nd Jan 2019, 11:34 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
I like to think of it like this: Q: What is the remainder of a smaller number divided by the larger number? A: It goes in zero times, with the smaller number left over. In other words, the smaller number will always be the remainder in a modulo division, like Denise Roßberg said.
23rd Jan 2019, 1:25 AM
Zeke Williams
Zeke Williams - avatar
+ 1
Awesome thanks for the explanation guys!!
23rd Jan 2019, 4:27 AM
TUMAINI BENJAMIN EMMANUEL
TUMAINI BENJAMIN EMMANUEL - avatar
+ 1
من نمیدونم 😕
23rd Jan 2019, 9:38 PM
Ruby
Ruby - avatar