This week's book giveaway is in the JavaScript forum. We're giving away four copies of Getting MEAN with Mongo, Express, Angular, and Node and have Simon Holmes on-line! See this thread for details.

can anybody teach me the way to find the hexadecimal and octal number of a given decimal?.Please help me immediately, i have just 4 day's left for my paper.

1.To find the hexadecimal number of a given decimal: Divide the decimal number by 16,divide the quotient obtained by 16 and store the remainder at each step.keep dividing the quotient by 16 at each step until quotient becomes 0.The remainders at each step taken in reverse order is the hexadecimal number.I would like to illustrate with an example. decimalno:=1000 1.dividend1=1000 divisor=16 quotient1=62 remainder1=8 Now for the second step dividend2=quotient1 2.dividend2=62 divisor=16 quotient2=3 remainder2=E(decimal 14=hexadecimal E) 3.dividend3=quotient2=3 divisor=16 quotient3=0 remainder3=3 since quotient3=0 the hexadecimal number for 1000=(remainder3 remainder2 remainder1) =(3E8) To obtain the octal number of a decimal number repeat the above process by 8. for 1000 the octal number would be: 1 dividend1=1000 divisor=8 quotient1=125 remainder1=0; 2.dividend2=quotient1=125 divisor=8 quotient2=15 remainder2=5 3. dividend3=quotient2=15 divisor=8 quotient3=1 remainder3=7 4.dividend4=quotient3=1 divisor=8 quotient4=0 remainder4=1 since quotient4=0 octalnumber=(remainder4 remainder3 remainder2 remainder1)=(1750)

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

nitin sharma
Ranch Hand

Joined: Feb 24, 2001
Posts: 290

posted

0

hello nachiket, Thank's a lot,U make's handling of bit's, binary,hexa, octa etc look's very easy.I get the feeling whenever i am in trouble in handling bit's i should alway's contact u. I wish that i should get atleast two to three question's on hexa and octa in the exam. Once again,Thanks' a lot.