|
-
Jan 22nd, 2006, 08:01 AM
#1
Thread Starter
New Member
OBtain Two Numbers from a single number
YOu are given any two numbers from 0 to 256.From this numbers u make a new number such that afterwards if only the new number is given u should get back the original two numbers..The new number and the original numbers are floating point numbers..They are integers
CAN ANY ONE FIND??I CHALLEENGE
-
Jan 22nd, 2006, 09:18 AM
#2
Fanatic Member
Re: OBtain Two Numbers from a single number
i dont see what your looking for?
Software languages known:
Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known:
Directx 7 and 8
Internet languages, in the process of learning:
HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
-
Jan 22nd, 2006, 11:59 AM
#3
Re: OBtain Two Numbers from a single number
err........
I picked two numbers and came up with a new number of 465829293998.
What two numbers did I pick then?
Seriously though...can you repeat the question again please?!
-
Jan 22nd, 2006, 05:29 PM
#4
Re: OBtain Two Numbers from a single number
One way:
Convert them both to binary, then append the second number to the first and convert the result back to decimal.
For example, given 1 and 2:
000000001 and 000000010
becomes: 000000010000000001 = 1025
Because you know that the numbers are between 1 and 256, you can convert to binary with a fixed number of digits, so to get the original number back you convert it to binary, take the first 9 digits and convert to give you the first number and take the second 9 digits to get the second number.
This, of course, would work equally well in any other base as long as you know how many digits are used in order to make the split.
zaza
PS: Homework, perchance? I'm not coding it for you!
-
Jan 24th, 2006, 08:37 AM
#5
Thread Starter
New Member
Re: OBtain Two Numbers from a single number
 Originally Posted by zaza
One way:
Convert them both to binary, then append the second number to the first and convert the result back to decimal.
For example, given 1 and 2:
000000001 and 000000010
becomes: 000000010000000001 = 1025
Because you know that the numbers are between 1 and 256, you can convert to binary with a fixed number of digits, so to get the original number back you convert it to binary, take the first 9 digits and convert to give you the first number and take the second 9 digits to get the second number.
This, of course, would work equally well in any other base as long as you know how many digits are used in order to make the split.
zaza
PS: Homework, perchance? I'm not coding it for you!
but 3rd number is 1025 not between 0 and 256
-
Jan 24th, 2006, 02:45 PM
#6
Re: OBtain Two Numbers from a single number
Sure in zazas suggestion the third number has a value >then 1024, but you didn't tell us that that was suspected.
also what kind of a number is a floating point integer?????
The new number and the original numbers are floating point numbers..They are integers
If you can't read your homework assignment, nobody will be able to help you.
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Jan 24th, 2006, 02:53 PM
#7
Re: OBtain Two Numbers from a single number
 Originally Posted by soorejmg
but 3rd number is 1025 not between 0 and 256
zaza just posted a suggestion, if it (the LOGIC) seems relevant to you then use it according you to your need.
we can just give you suggestions, nobody will do your home-work here. you need to work on these logics to your need.
Harsh
-
Jan 24th, 2006, 03:20 PM
#8
Re: OBtain Two Numbers from a single number
If one of them is 0, then the other can be any number
-
Jan 26th, 2006, 11:58 AM
#9
Re: OBtain Two Numbers from a single number
If decimal values are allowed, this is dead easy. But I, too, am trying to figure out if it's a floating point number, or an integer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|