Rama Hints

Addition and Subtraction

  • To add numbers in decimal, you start with the right-most digit and add numbers one digit at a time.  Take a problem such as:

    257
    + 315
    -----
    572

    Working one digit at a time, you can solve this as follows:

       7 + 5 = 12  (leave the "2" and carry the "1")
    1 + 5 + 1 = 7   (where the first 1 is carried from before)
       2 + 3 = 5

    Now, look at a similar problem in hexadecimal.  Remember when you count in hex that "10" comes after "F" as in: ... 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14 ...

    3F2C
    + 1A45
    ------
    5971

       C + 5 = 11  (leave the last "1" and carry the first)
    1 + 2 + 4 = 7
       F + A = 9
    1 + 3 + 1 = 5

    Addition in octal works the same way, only "10" comes immediately after 7: ... 4, 5, 6, 7, 10, 11, 12 ...

    245
    + 135
    -----
    402

       5 + 5 = 12
    1 + 4 + 2 = 10
    1 + 2 + 1 = 4

    Now, let's look at subtraction, first in decimal.  As in addition, you work from the right to the left.  If the first number is smaller than the second, you borrow "1" from the digit immediately to the left to gain an extra 10.  Here's an example:

    723
    - 235
    -----
    488

       13 - 5 = 8   (you need to borrow a 1)
    12 - 3 - 1 = 8   (borrow a 1, and subtract the 1 from before)
    7 - 2 - 1 = 4   (subtract the 1 from before)

    Do the same in hex, remembering that "10" is just after F:
    C23
    - 519
    -----
    70A

       13 - 9 = A   (borrow a 1)
    2 - 1 - 1 = 0   (subtract the 1 you borrowed)
        C - 5 = 7

    Why does 13 - 9 = A?  Count 9 numbers backwards from 13, if you're not sure: 12, 11, 10, F, E, D, C, B, A.

    And the same works in octal, where "10" is just after 7 (it's decimal 8):

    456
    - 172
    -----
    264

        6 - 2 = 4
       15 - 7 = 6   (borrow a 1)
    4 - 1 - 1 = 2   (subtract the borrowed 1)

    If you still can't figure this out, many calculators, including the one included with Win 95, support hex and octal math.  You can always plug the problems you'll get in Rama into a calculator if you'd rather do it that way.