Thursday, July 29, 2010

Arithmetic Operation -Octal & Hexadecimal

Octal Addition and Subtraction : Radix or Base for Octal numbers are 8 and consists 0 to 7. While adding we follow following rules:

Addition

We already know that 8 is the base or radix of the Octal Number System, after adding of two digit if you get below 8 then write down it, but if it is more than 7 then divide the result by 8 and write down the remainder in the place of result and the quotient as carry numbers.

Example-1

(447)8 + (622)8
                      
                                                                    Rules

       1                     1) 7 + 2 = 9 (above 7) 9/8 Quotient=1 Remainder=1 (Carry = 1)
 ------------            2) 4 + 2 + 1(carry)=7 is below 8 (Carry = 0)
    4 4 7                   3) 4 + 6 = 10 (above 7) 10/8 Quotient=1 Remainder=2(Carry = 1)
    6  2 2
 ------------
  1 2 7 1
 ------------
  Answer :  (447)8 + (622)8= (1271)8



Example-2

(237.54)8 + (753.74)8
    
                                                            Rules

    1 1 1 1                1) 4 + 4 = 8 (8/8 Quotient=1 Remainder=0)(Carry = 1)
---------------          2) 5 + 7 + 1 (carry) = 13(13/8 Quotient=1 Remainder=5)Carry = 1)
   
3 7 . 5 4               3) 7 + 2 + 1 (carry) = 10(10/8 Quotient=1 Remainder=2)(Carry = 1)
    7 2 . 7 4              4) 3 + 7 + 1 (carry) = 11(11/8 Quotient=1 Remainder=3)(Carry = 1)
---------------
 1 3 2 . 5 0
---------------

  Answer :  (37.54)8 + (72.74)8= (132.50)8


Subtraction


Octal Subtraction : While subtracting if minuend digit smaller than subtend then add 8 to the minuend digit and then subtract and in the process 1 should be borrow from the minuend digit at the end.

Example-1

(345)8 - (126)8

                                                    Rules
     1                     1) 5 is less than 6 so 5+8 = 13 - 6= 7 (Borrow = 1)
------------          2) 4 -1(borrow) = 3 is bigger than subtend so 3 - 2=1(Borrow = 0)
  
3 4 5                 3) 3 -1 = 2 (Borrow = 0)
   1 2 6
 ------------
   2 1 7
 ------------
  Answer :  (345)8 - (126)8 = (217)8



Example-2

(246.24)8 - (157.56)8

                                                           Rules


   1 1 1    1           1) 4 + 8 - 6 = 6 (Borrow = 1)
 --------------      2) 2-1(borrow) =1 + 8 - 5 = 4 (Borrow = 1)
    2 4 5 .2 4         3) 5-1(borrow) =4 + 8 - 7 = 5 (Borrow = 1)
   1 5 7 . 5 6         4) 4-1(borrow) =3 + 8 - 5 = 6 (Borrow = 1)
 ---------------       5) 2-1(borrow) =1 - 1 = 0 (Borrow = 0)
   0 6 5 . 4 6
 ---------------

  Answer :  (246.24)8 - (157.56)8 = (65.56)8



Hexadecimal Addition and Subtraction : Radix or Base for Octal numbers are 16 and consists 0 to 15 (0 - 9, A, B, C, D, E, F). While adding we follow following rules:

Addition

We already know that 16 is the base or radix of the Hexadecimal Number System, after adding of two digit if you get below 16 then write down it, but if it is more than 15 then divide the result by 15 and write down the remainder in the place of result and the quotient as carry numbers. Replace Alphabet with its equivalent decimal numbers. e.g.. A = 10 or E = 14

Example-1

B83)16 + (A2D)16 = (11 8 3)16 + (10 2 13)16

                                                             Rules

         1                 1) 3 + 13 = 16(above 15) 16/16 Quotient=1 Remainder=0(Carry=1)
 ------------          2) 8 + 2 + 1(carry)= 11 is below 15 (Carry=0)
    11   8   3         3) 10 + 11 = 21(above 15) 21/16 Quotient=1 Remainder=5(Carry=1)
    10   2 13
 ------------
  1 5   11 0  = 1 5 B 0
 ------------

  Answer :(B83)16 + (A2D)16 = (15B0)16



Example-2

(AB.CD)16 + (D5.2F)16 = (10 11.12 13)16 + (13 5.2 15)16

                                                      Rules

   1          1                1) 13 + 15 = 28 (28/16 Quotient=1 Remainder=12(Carry = 1))
 -----------------        2) 12 + 2 + 1(carry) = 15 is below 15 (Carry = 0))
   10 11 .12 13          3) 11 + 5 = 16 (16/16 Quotient=1 Remainder=0 (Carry = 1))
   13  5  .  2 15         4) 10 + 13 + 1(carry)= 24 (24/16 Quotient=1 Remainder=8 (Carry = 1))
-----------------
  1 8 0  . 15 12       = 180.FC16
------------
  Answer : (AB.CD)16 + (D5.2F)16  = (180.FC)16



Subtraction


Hexadecimal Subtraction : While subtracting if minuend digit smaller than subtend then add 16 to the minuend digit and then subtract and in the process 1 should be borrow from the minuend
digit at the end.

Example-1

(BA3)16 - (AB4)16 = (11 10 3)16 - (10 11 5)16)

                                                             Rules

         1              1) 3 is less than 5 so 3 + 16 = 19 - 4= 15 (F) (Borrow = 1)
-------------       2) 10 - 1(borrow) = 9 + 16 = 25 - 11 = 14 (E) (Borrow = 1)
  11 10  3           3) 11 -1 = 10 = 10 - 10 = 0 (Borrow = 0)
 
10 11  4
------------
   0   E   F
------------

  Answer : (BA3)16 - (AB4)16 = (EF)16



Example-2

(C5.A2)16 - (A7.B3)16 =  ((12 5.10 2)16 - (10 7.11 3)16)

                                               Rules

   1    1    1                 1)  2 + 16 - 3 = 15 (F) (Borrow = 1)
---------------              2)  10-1(borrow) =9 + 16 - 11 = 14 (E) (Borrow = 1)
  12  5 . 10  2             3)  5-1(borrow) =4 + 16 - 7 = 13 (D) (Borrow = 1)
  10  7 . 11  3             4)  12-1(borrow) =11 - 10 = 1
---------------
  1  D .  E   F
---------------
  Answer : (C5.A2)16 - (A7.B3)16 = (17.EF)8



After fortnight coming back with some more with system only. !

1 comment:

Unknown said...

in octal subtraction eg 2 answer should be 65.46