This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.

Can someone help me out on short cuts of converting decimal and octal numbers to and from binary. My exams is next saturday.

SCJA(Beta) SCJP 1.4 SCWCD 1.4 SCBCD 1.3 SCBCD 5.0 beta <br />The more practice we get, the better we are at the exams and in life in general. Pls join me at My DEN.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org

MI Mohammed
Ranch Hand

Joined: Feb 16, 2005
Posts: 146

posted

0

Marc, Result from my last post on this topic was very helpful, i now know that in hex 0000 --> 0 so to get other simply add 1 to 0000 downwards. i just need a similar formula for oct and binary. cheers

Do you understand the rationale behind these representations?

For example, decimal numbers use ten as a base. This means that each digit represents a quantity multiplied by ten raised to some power. Specifically, the right digit is multiplied by 10^0, the digit to the left of that is multiplied by 10^1, the digit to the left of that is multiplied by 10^2, and so on.

So in base ten, 987 means (9 * 10^2) + (8 * 10^1) + (7 * 10^0).

In binary, the base is two, so 101 means (1 * 2^2) + (0 * 2^1) + (1 * 2^0).

In octal, the base is eight, so 765 means (7 * 8^2) + (6 * 8^1) + (5 * 8^0).

In hexadecimal, the base is 16 (with letters a-f used to represent 10-15), so c9a means (12 * 16^2) + (9 * 16^1) + (10 * 16^0).

With this understanding, do you see the patterns below?

MI Mohammed
Ranch Hand

Joined: Feb 16, 2005
Posts: 146

posted

0

Mike, Thanks a million. Got to read your reply after my exams. Well i passed with 77%, not quite happy with it cause i made some silly errors. Once thanks