Can someone make this VB program

Status
Not open for further replies.
Level 22
Joined
Feb 3, 2009
Messages
3,291
Can some one make me a program that will convert any number into the 0 and 1 language. I will demonstrate how it works :

Let's say i pick number 25:

12 x 2 + 1
6 x 2 + 0
3 x 2 + 0
1 x 2 + 1
0 x 2 + 1

so we have 25 = 11001
(the numbers we get must be writen from down to up) so 10011 is wrong.

Then for reverse from 11001 to 25 we do:

1 x 2^0 = 1
0 x 2^1 = 0
0 x 2^2 = 0
1 x 2^3 = 8
1 x 2^4 = 16

1 + 0 + 0 + 8 + 16 = 25

And we are done.

So if anyone can make this, i tryed but failed.:sad:
 
Can some one make me a program that will convert any number into the 0 and 1 language. I will demonstrate how it works :

Let's say i pick number 25:

12 x 2 + 1
6 x 2 + 0
3 x 2 + 0
1 x 2 + 1
0 x 2 + 1

so we have 25 = 11001
(the numbers we get must be writen from down to up) so 10011 is wrong.

Then for reverse from 11001 to 25 we do:

1 x 2^0 = 1
0 x 2^1 = 0
0 x 2^2 = 0
1 x 2^3 = 8
1 x 2^4 = 16

1 + 0 + 0 + 8 + 16 = 25

And we are done.

So if anyone can make this, i tryed but failed.:sad:


See binary code works like this:


25 = 11001

let's first of all reverse this number -> 10011 (it's easier)

The first number (1) is "1"
The second number (0) is "2"
The third number (0) is "4"
The forth number (1) is "8"
The fith number (1) is "16"

So you have 1x1 + 0x2 + 0x4 + 1x8 + 1x16 = 25

In the end the whole thing is read from the other direction. "1" is the number on the right.
 
Status
Not open for further replies.
Back
Top