• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

determine binary value , concept not clear yet!!!

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

try it for 10...
hope this help
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<HTML>
Maybe this will also help.


Binary
<table border=1 > <td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td >1</td><td>0</td><td>0</td></tr><tr> <td>27</td><td>26</td><td>25</td><td>24</td> <td>23</td><td>22</td><td >21</td><td>20 </td></tr> <tr><td >128</td> <td >64</td> <td >32</td> <td >16</td> <td >8</td> <td>4</td><td>2</td><td > 1 </td></tr> </table> 64 * 1 + 32 * 1 + 4 * 1 = 100 Octal <table border="1" ;> <tr><td> 0 </td> <td > 0 </td> <td > 0 </td> <td > 0 </td><td >0</td> <td>1</td><td>4</td><td>4</td></tr><tr><td>87</td><td>86</td> <td>85</td><td>84</td><td>83</td><td>82</td><td>81</td> <td>80</td></tr> <tr><td >2097152</td> <td >262144</td> <td >32768</td> <td>4096</td> <td >512</td> <td >64</td><td>8</td><td>1</td></tr> </table>


64 * 1 + 8 * 4 + 1 * 4 = 100


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.

Cheers

Sahir

http://www.geocities.com/sahirshah/
</HTML>
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic