This week's book giveaway is in the Design forum. We're giving away four copies of Building Microservices and have Sam Newman on-line! See this thread for details.

hi , thx for your reply. but the entire concept of binary values is yet not clear to me. can i get a step by step explantion on how to get binnary value of a smalller number , , lets say 5 or 10, etc thx a lot regards Kamal

Hi There..., To convert number to binary, octal or hex number, you must always divide the number with the required base, for your confinience here is the required base for each number system : binary : base 2 octal : base 8 hex : base 16 Convert 5 to BINARY (base 2): 5 / 2 = 2 remainder : 1 2 / 2 = 1 remainder : 0 1 / 2 = 0 remainder : 1 binary for 5 is : 101 Convert 5 to OCTAL (base 8): 5 / 8 = 0 remainder : 5 octal for 5 is : 005 note : octal numbers are represented by 3 digit Convert 5 to HEX (base 16): 5 / 16 = 0 remainder : 5 hex for 5 is : 0x0005 note : hex numbers are represented by 4 digit preceeded by 0x

Just picture this table in your mind when you want a binary representation of a decimal number. With some practice you will be equally comfortable with binary numbers as you are with decimal numbers.

Kamal, Have a look at the odometer in your car. (It is the counter within the speedometer that tells you how far you have travelled). It is a decimal counter ie. has digits from 0 to 9. Before you start you set it to 0. If you travel 4 km, it shows 0004 After 9 km it shows 0009 After 10 km it shows 0010 and so on. Now imagine a car whose odometer is binary ie. has only two digits 0 and 1. The odometer readings will now be 0000 at start 0001 after 1 km 0010 after 2 km 0011 after 3 km 0100 after 4 km . . 1000 after 8 km 1001 after 9 km 1010 after 10 km and so on. This is how you count in the binary number system. If you were counting using the octal system, your odometer would have numbers from 0 to 7 only. Hexadecimal systems would have 16 digits 0 to 9, then a to f. Hope this makes things a bit clearer. Regards, Dilip

[This message has been edited by Dilip Varma (edited February 24, 2001).]