Notice that three operators represent division. Each operator computes
the result of a division expression in a different way.
- /
- Divide and express the answer possibly as a decimal number.
For example:
7 / 2 /* result is 3.5 */
6 / 2 /* result is 3 */
- %
- Divide and express the answer as a whole number. The remainder
is ignored. For example:
7 % 2 /* result is 3 */
- //
- Divide and express the answer as the remainder only. For example:
7 // 2 /* result is 1 */