# Octals, Decimals and Hexadecimals

William Alldred

Greenhorn

Posts: 4

Michael Morris

Ranch Hand

Posts: 3451

Cindy Glass

"The Hood"

Sheriff

Sheriff

Posts: 8521

posted 12 years ago

I

Octal uses a ones place, and 8's place, a 64's place, 512 etc. Basically you just need to find out how many of each that you need.

To convert 489 decimal to octal

512's = 0 too big

64's = 7 divide 489 by 64 = 7 remainder 41

8's = 5 divide 41 by 8 = 5 remainder 1

1's = 1

So 489 decimal = 751 octal.

For hex you have 1's, 16's, 256's, 4096's etc.

256's = 1 divide 489 by 256 = 1 remainder 233

16's = 14 (represented by "e") divide 233 by 16 = 14 remainder 9

1's = 9

So 489 decimal = 1e9 hex

[ June 26, 2003: Message edited by: Cindy Glass ]

**think**that he means by hand.Octal uses a ones place, and 8's place, a 64's place, 512 etc. Basically you just need to find out how many of each that you need.

To convert 489 decimal to octal

512's = 0 too big

64's = 7 divide 489 by 64 = 7 remainder 41

8's = 5 divide 41 by 8 = 5 remainder 1

1's = 1

So 489 decimal = 751 octal.

For hex you have 1's, 16's, 256's, 4096's etc.

256's = 1 divide 489 by 256 = 1 remainder 233

16's = 14 (represented by "e") divide 233 by 16 = 14 remainder 9

1's = 9

So 489 decimal = 1e9 hex

[ June 26, 2003: Message edited by: Cindy Glass ]

"JavaRanch, where the deer and the Certified play" - David O'Meara

Richard Jensen

Ranch Hand

Posts: 67

posted 12 years ago

I learned a different method for converting decimal numbers to other bases--repeated division by the target base:

You repeat the division until the remainder is less than the divisor. Then construct the number by going back up the remainders (7, 5, 1).

Originally posted by Cindy Glass:

To convert 489 decimal to octal

512's = 0 too big

64's = 7 divide 489 by 64 = 7 remainder 41 8's = 5 divide 41 by 8 = 5 remainder 1

1's = 1

So 489 decimal = 751 octal.

I learned a different method for converting decimal numbers to other bases--repeated division by the target base:

You repeat the division until the remainder is less than the divisor. Then construct the number by going back up the remainders (7, 5, 1).

Richard

N 37 33 W 122 18

Michael Morris

Ranch Hand

Posts: 3451

William Alldred

Greenhorn

Posts: 4

posted 12 years ago

Originally posted by Cindy Glass:

Ithinkthat he means by hand.

Octal uses a ones place, and 8's place, a 64's place, 512 etc. Basically you just need to find out how many of each that you need.

To convert 489 decimal to octal

512's = 0 too big

64's = 7 divide 489 by 64 = 7 remainder 41

8's = 5 divide 41 by 8 = 5 remainder 1

1's = 1

So 489 decimal = 751 octal.

For hex you have 1's, 16's, 256's, 4096's etc.

256's = 1 divide 489 by 256 = 1 remainder 233

16's = 14 (represented by "e") divide 233 by 16 = 14 remainder 9

1's = 9

So 489 decimal = 1e9 hex

[ June 26, 2003: Message edited by: Cindy Glass ]

William Alldred

Greenhorn

Posts: 4

Michael Morris

Ranch Hand

Posts: 3451

posted 12 years ago

I doubt it, unless it's changed significantly. But any programmer should be able to make these conversions without breakin' a sweat.

Originally posted by William Alldred:

yes, I meant by hand. I believe I will need to in the Programmer exam.

I doubt it, unless it's changed significantly. But any programmer should be able to make these conversions without breakin' a sweat.

*Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction.* - Ernst F. Schumacher

William Alldred

Greenhorn

Posts: 4

posted 12 years ago

I seem to remember some practice questions which would require a conversion in order to find the correct answer. However, I hope to God I'm wrong !

Originally posted by Michael Morris:

I doubt it, unless it's changed significantly. But any programmer should be able to make these conversions without breakin' a sweat.

I seem to remember some practice questions which would require a conversion in order to find the correct answer. However, I hope to God I'm wrong !