DD

Ranch Hand

Posts: 66

sean cee

Ranch Hand

Posts: 115

posted 16 years ago

Hi,

It's simple..

Decimal 0 1 2 3 4 5 6 7 8 9 then 10

Octal 0 1 2 3 4 5 6 7 8 then 10

how to convert Dec 113 to Oct?

113 div 8 = 14 with remainder 1

14 div 8 = 1 with remainder 6

1 div 8 = 0 with remainder 1

divide until you get 0 ... then look at the remainders ...

read them up from bottom..

so Decimal 113 = Octal 161

How do you convert Octal 161 to Dec 113?

gotta memorise one thing :

right most digit means 8 to the power of 0

2nd to right most digit means 8 to the power of 1

3rd to right most digit means 8 to the power of 2

so on...

take 161 ..

multiply right most 1 by 8 to the power of 0 which is 1 .

multiply 6 by 8 to the power of 1 which is 48.

multiply left most 1 by 8 to the power of 2 wichi is 64 .

add those three results which is 113 .. back to our octal number.

I don't know if I make any sense.. but this is kinna hard to explain over a message post.

Hope this helps

It's simple..

Decimal 0 1 2 3 4 5 6 7 8 9 then 10

Octal 0 1 2 3 4 5 6 7 8 then 10

how to convert Dec 113 to Oct?

113 div 8 = 14 with remainder 1

14 div 8 = 1 with remainder 6

1 div 8 = 0 with remainder 1

divide until you get 0 ... then look at the remainders ...

read them up from bottom..

so Decimal 113 = Octal 161

How do you convert Octal 161 to Dec 113?

gotta memorise one thing :

right most digit means 8 to the power of 0

2nd to right most digit means 8 to the power of 1

3rd to right most digit means 8 to the power of 2

so on...

take 161 ..

multiply right most 1 by 8 to the power of 0 which is 1 .

multiply 6 by 8 to the power of 1 which is 48.

multiply left most 1 by 8 to the power of 2 wichi is 64 .

add those three results which is 113 .. back to our octal number.

I don't know if I make any sense.. but this is kinna hard to explain over a message post.

Hope this helps

Sean <br />SCJP2, SCJP2p1.4, SCWCD

Graeme Brown

Ranch Hand

Posts: 193

posted 16 years ago

Here is a quick way to convert binary to octal, just put it into groups of three digits and convert each. Example:

54321 decimal

= 1101010000110001 binary

split into groups (and pad with leading zeroes)

001 101 010 000 110 001

= 152061 octal

of course it is just as easy to go the other way

12345 octal

= 001 010 011 100 101 binary

[This message has been edited by Graeme Brown (edited October 25, 2000).]

54321 decimal

= 1101010000110001 binary

split into groups (and pad with leading zeroes)

001 101 010 000 110 001

= 152061 octal

of course it is just as easy to go the other way

12345 octal

= 001 010 011 100 101 binary

[This message has been edited by Graeme Brown (edited October 25, 2000).]

DD

Ranch Hand

Posts: 66

Don't get me started about those stupid light bulbs. |