| Contact PSVM (Q & A) | Notes Below Audio | [toc] [prev] Slide 9 of 13 [next] |
|
|
| 1, 2, 3, 4, 5, 6, 7, 8, [9 (top)], 10, 11, 12, 13, [Lab] |
|
Notes for Slide 09 This slide shows the final arithmetic operator for ints. The modulus-operator: % :will produce the remainder from dividing the first number by the second number. Similar to the arithmetic operators shown on the previous slide, the modulus-operator is placed between two ints and produces a result of an int. The top example shows a set-statement and the resulting int value placed in the cents variable given the value shown in the total variable. The example on the bottom is meant to show one way to guarantee that any positive random number is reduced to a value between zero and fifty-one. 1, 2, 3, 4, 5, 6, 7, 8, [9 (top)], 10, 11, 12, 13, [Lab] |