+ 1
The use of math in coding
How should i know when to use "/" and "%"
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.