+ 1

Why is division a different function than modulus? Do they not preform the same function?

6th Feb 2020, 2:57 PM
Trash Bandicode
Trash Bandicode - avatar
5 Antworten
+ 3
Because division / show the Quotient and the % shows us reminder. Ex. 2/2 = 1 2%2=0 It shows different values That's why we can not use same function. I hope you understand.
6th Feb 2020, 3:05 PM
ㅤㅤㅤㅤㅤㅤ
ㅤㅤㅤㅤㅤㅤ - avatar
+ 3
If I have 7 cookies and 2 kids, how many complete cookies will each kid get? 7/2 == 3 (Decimals are ignored.) And how many cookies will be left over? 7%2 == 1
6th Feb 2020, 3:17 PM
HonFu
HonFu - avatar
+ 2
Modulus is for Remainder, Division is for, Division.
6th Feb 2020, 3:00 PM
Pie
Pie - avatar
+ 1
Why? This function is very useful for mathematical calculations. For example, a decimal number can be converted into a binary number using the modulo division. This is a good task for code practice in any program language. I recommend solving that.
6th Feb 2020, 4:15 PM
JaScript
JaScript - avatar
+ 1
Their roles are different. One gives remainder while the other gives quotient of division.
7th Feb 2020, 2:53 AM
Sonic
Sonic - avatar