Results 1 to 9 of 9

Thread: OBtain Two Numbers from a single number

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    3

    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

  2. #2
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    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

  3. #3
    Fanatic Member Andy_P's Avatar
    Join Date
    May 2005
    Location
    Dunstable, England
    Posts
    669

    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?!
    Using Windows XP Home sp3
    Mucking around with C# 2008 Express
    while ( this.deadHorse ) { flog( ); }


  4. #4
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    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!

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    3

    Re: OBtain Two Numbers from a single number

    Quote 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

  6. #6
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    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!

  7. #7
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: OBtain Two Numbers from a single number

    Quote 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
    Show Appreciation. Rate Posts.

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: OBtain Two Numbers from a single number

    If one of them is 0, then the other can be any number

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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
  •  



Click Here to Expand Forum to Full Width