1) The formula used to return a whole number when doing division is " % "
2) The remainder of a division can be discovered using the operator
%:>>> 26%7
5
3) In computing it is important to understand number systems and in particular binary, because it is very useful and simple for us humans who are used to working in base 10.
4) The binary system works like this 01001010
4) The binary system works like this 01001010
155 can be subtracted by 128, producing 27:
| 155 - 128 = 27 | |||||||
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 1 | |||||||
Our new number, 27, can’t be subtracted by either 64 or 32. Both of those positions get a 0. We can subtract by 16, producing 11.
| 27 - 16 = 11 | |||||||
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 1 | 0 | 0 | 1 | ||||
And 8 subtracts from 11, producing 3. After that, no such luck with 4.
| 11 - 8 = 3 | |||||||
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | ||
Our 3 can be subtracted by 2, producing 1. And finally, the 1 subtracts by 1 to make 0.
| 3 - 2 = 1 | |||||||
| 1 - 1 = 0 | |||||||
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 |
5)

No comments:
Post a Comment