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. |
14 random numbers | 127 | 342 | 252 | 233 | 470 | 239 | 247 | 280 | 459 | 271 | 416 | 150 | 495 | 366 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
multiply by 3 | 381 | 1026 | 756 | 699 | 1410 | 717 | 741 | 840 | 1377 | 813 | 1248 | 450 | 1485 | 1098 |
sort from left to right | 381 | 450 | 699 | 717 | 741 | 756 | 813 | 840 | 1026 | 1098 | 1248 | 1377 | 1410 | 1485 |
shift to the right | 0 | 381 | 450 | 699 | 717 | 741 | 756 | 813 | 840 | 1026 | 1098 | 1248 | 1377 | 1410 |
modulo remainder | 381 | 69 | 249 | 18 | 24 | 15 | 57 | 27 | 186 | 72 | 150 | 129 | 33 | 75 |
sort from left to right | 15 | 18 | 24 | 27 | 33 | 57 | 69 | 72 | 75 | 129 | 150 | 186 | 249 | 381 |
shift to the right | 0 | 15 | 18 | 24 | 27 | 33 | 57 | 69 | 72 | 75 | 129 | 150 | 186 | 249 |
modulo remainder | 15 | 3 | 6 | 3 | 6 | 24 | 12 | 3 | 3 | 54 | 21 | 36 | 63 | 132 |
sort from left to right | 3 | 3 | 3 | 3 | 6 | 6 | 12 | 15 | 21 | 24 | 36 | 54 | 63 | 132 |
shift to the right | 0 | 3 | 3 | 3 | 3 | 6 | 6 | 12 | 15 | 21 | 24 | 36 | 54 | 63 |
modulo remainder | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 6 | 3 | 12 | 18 | 9 | 6 |
sort from left to right | 3 | 3 | 3 | 6 | 6 | 9 | 12 | 18 | ||||||
shift to the right | 0 | 3 | 3 | 3 | 6 | 6 | 9 | 12 | ||||||
modulo remainder | 3 | 0 | 0 | 0 | 0 | 3 | 3 | 6 | ||||||
sort from left to right | 3 | 3 | 3 | 6 | ||||||||||
shift to the right | 0 | 3 | 3 | 3 | ||||||||||
modulo remainder | 3 | 0 | 0 | 0 |