jumble with numbers
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: jumble with numbers

  1. #1
    Join Date
    Aug 2013
    Posts
    2

    jumble with numbers

    In NASA, two researchers, Mathew and John, started their work on a new planet, but while practicing research they faced a mathematical difficulty. In order to save the time they divided their work.
    So scientist Mathew worked on a piece and invented a number computed with the following formula:
    A Mathew number is computed as follows using the formula:
    H(n) = n(2n-1)
    And scientist John invented another number which is built by the following formula which is called John number.
    T(n) = n(n+1)/2
    Now Mathew and John are jumbled while combining their work. Now help them combine their research work by finding out number in a given range that satisfies both properties. Using the above formula, the first few Mathew-John numbers are:
    1 6 15 28

    Input Format:

    Input consists of 3 integers T1,T2,M separated by space . T1 and T2 are upper and lower limits of the range. The range is inclusive of both T1 and T2. Find Mth number in range [T1,T2] which is actually a Mathew-John number.


    Line 1

    T1 T2 M,where T1 is upper limit of the range, T2 is lower limit of the range and M ,where Mth element of the series is required
    Constraints:

    0 < T1 < T2 < 1000000


    Output Format:

    Print Mth number from formed sequence between T1 and T2(inclusive).

    Line 1
    For Valid Input,print

    Print Mth number from formed sequence between T1 and T2
    Or
    No number is present at this index

    For Invalid Input,print

    Invalid Input


    Sample Input and Output

    SNo. Input Output
    1
    90 150 2

    120
    2
    20 80 6

    No number is present at this index
    3
    -5 3 a

    Invalid Input

  2. #2
    Join Date
    Aug 2013
    Posts
    2

    Re: jumble with numbers

    plzzzzzz.....give me sollution for this thread...its very urgent...

  3. #3
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,316

    Re: jumble with numbers

    Quote Originally Posted by Tejaswi Godavarthi View Post
    plzzzzzz.....give me sollution for this thread...its very urgent...
    It may be urgent to you, but this has the look of an assignment which if it is we won't be providing a ready made answer for you as that would be classed as cheating. If this is an assigment, have a read of
    http://forums.codeguru.com/showthrea...ork-assignment

    Until you can provide some code for us to comment upon, possibly the best advice we could give is to ask how you would do this without a computer using just pen and paper? Once you know how to do it manually, then that can be expressed as an algorithm and then a program design can be done and finally a program can be coded to implement the algorithm/design.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center