HINT: The modulo % operator yields the remainder of division and the quotient is ignored.
HENCE: 5 ÷ 2 = 2.5, but 5 % 2 = 1 {1 remaining after dividing 5 by 2}. Refresh this page. |
12 random numbers | 93 | 14 | 89 | 179 | 170 | 218 | 361 | 147 | 392 | 44 | 178 | 28 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
multiply by 3 | 279 | 42 | 267 | 537 | 510 | 654 | 1083 | 441 | 1176 | 132 | 534 | 84 |
sort from left to right | 42 | 84 | 132 | 267 | 279 | 441 | 510 | 534 | 537 | 654 | 1083 | 1176 |
shift to the right | 0 | 42 | 84 | 132 | 267 | 279 | 441 | 510 | 534 | 537 | 654 | 1083 |
modulo remainder | 42 | 0 | 48 | 3 | 12 | 162 | 69 | 24 | 3 | 117 | 429 | 93 |
sort from left to right | 3 | 3 | 12 | 24 | 42 | 48 | 69 | 93 | 117 | 162 | 429 | |
shift to the right | 0 | 3 | 3 | 12 | 24 | 42 | 48 | 69 | 93 | 117 | 162 | |
modulo remainder | 3 | 0 | 0 | 0 | 18 | 6 | 21 | 24 | 24 | 45 | 105 | |
sort from left to right | 3 | 6 | 18 | 21 | 24 | 24 | 45 | 105 | ||||
shift to the right | 0 | 3 | 6 | 18 | 21 | 24 | 24 | 45 | ||||
modulo remainder | 3 | 0 | 0 | 3 | 3 | 0 | 21 | 15 | ||||
sort from left to right | 3 | 3 | 3 | 15 | 21 | |||||||
shift to the right | 0 | 3 | 3 | 3 | 15 | |||||||
modulo remainder | 3 | 0 | 0 | 0 | 6 |