+ 1

The use of math in coding

How should i know when to use "/" and "%"

14th Oct 2024, 12:29 AM
carlo jose santos
carlo jose santos - avatar
1 Réponse
+ 7
If you wanna retrieve "Quotient" use /, and if you wanna retrieve "Remainder" use %. Example: 10 / 5 = 2 [ the quotient ] 10 % 5 = 0 [ the remainder ] We use mod (%) to check whether the number1 is fully divisible by number2. In our case numbers were 10, 5. In conclusion I just wanna say please try "FizzBuzz" code solution.
14th Oct 2024, 1:59 AM
Luo Shenshi
Luo Shenshi - avatar