posted 24 years ago
Hi Nitin!
let me try if i can help you.
1)to convert decimal to octal
remember octal numbers are from 0 to 7 i.e.
decimal 0 is octal 0
decimal 1 is octal 1
......
......
decimal 7 is octal 7
if i want to convert 19 to octal i will devide 19 by 8 and write the remainders in reverse order to get a octal number.see how it happens
19/8 gives Quotient=2
Remainder=3
now devide 2(ie the Quotient) by 8
gives Quotient=0
Remainder=2
now writing remainders in reverse order gives octal number=23
19(in decimal)=23(in octal)
2)to convert decimal to hexadecimal
hexadecimal numbers run from decimal 0 to decimal 15.but written as 0,1,2,3,4,5,---9,A,B,C,D,E,F
to convert a decimal to hexadecimal devide the number by 16 and write the remainders in reverse order.lets take an example.
to convert decimal 49 in hexadecimal
49/16 gives Quotient=3
Remainder=1
deviding 3( ie Quotient) by 16
gives Quotient=0
Remainder=3
now write decimal in reverse order
49(in decimal)=31(in hexadecimal)
(remember you have to keep deviding the quotient by the divisor
till the quotient becomes zero)
hope this helps