Help in 2 programs required???

Discussion in 'C' started by internet_bug, Nov 8, 2008.

Thread Status:
Not open for further replies.
  1. internet_bug

    internet_bug New Member

    Joined:
    Sep 16, 2008
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Well we got an assignment of 20 questions, i am able to solve 18 of them but these 2 questions are getting off my brain, can anyone please help me to make these


    15. Write an algorithm that inputs two fractions in the form a/b and c/d, and outputs their sum in the form p/q cancelled down to its simplest form.

    --------------------

    19. FRACTIONS TO DECIMALS: Write a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator, that prints out the decimal representation. If the decimal representation has a repeating sequence of digits, it should be indicated by enclosing it in brackets. For example, 1/3 = .33333333...is denoted as .(3), and 41/333 = .123123123...is denoted as .(123).

    Typical conversions are:

    1/3 = .(3)
    22/5 = 4.4
    1/7 = .(142857)
    3/8 = .375
    45/56 = .803(571428)

    Test your program with the fractions above and the fraction 11/59.

    Sample Run

    ENTER N,D : 1,7

    1/7 = .(142857)
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,335
    Likes Received:
    377
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice