Ask Experts Questions for FREE Help !
Ask
    Bill9_21's Avatar
    Bill9_21 Posts: 1, Reputation: 1
    New Member
     
    #1

    Feb 8, 2012, 02:56 AM
    Modify a simple C progam
    Modify the program so that the user enters both fractions at the same time, separated by a plus sign:

    Enter two fractions separated by a plus sign: 1/2 1/4

    The sum is 3/4



    #include
    #include

    Int main(void)
    {
    Int num1, denom1, num2, denom2, result_num, result_denom;

    Printf("Enter first fraction: ");
    Scanf("%d/%d", &num1, &denom1);

    Printf("Enter second fraction: ");
    Scanf("%d/%d", &num2, &denom2);

    Result_num = num1 * denom2 num2 * denom1;
    Result_denom = denom1 * denom2;
    Printf("The sum is %d/%d\n", result_num, result_denom);

    Return 0;
    }

Check out some similar questions!

Theft Diversion Progam [ 2 Answers ]

Last November I was caught for petty theft. I hired a lawyer to show up for my court cases and help me get my records expunged, however, I haven't heard from the diversion program for approximately 4 months. Do anyone know how long it takes for the diversion program to call you? I'm getting...

Is it possible to modify an IC (microchip)? [ 2 Answers ]

Hi guys... my cousin is working on a small robotic science project.I was wondering,is it possible to modify a microchip from a TV or any other electronics in a house hold,so it can be used as microcontroler for the robot?

Non simple answers to simple Yes/no questions. [ 18 Answers ]

Not knowing exactly where to put this, I'll try relationships: Alult male son and elderly mother. I'll start by an example: It's bedtime and, the kitchen light is currently on and her pills are usually on the kitchen table. Son asks, "Mom, do you need to come back into the kitchen?" ...

How do you progam a computer? [ 3 Answers ]

March 3, 2009, I’m in the middle of writing a series of programs that a computerized mechanism/chip can describe (in detail) what those instructions are, for that specific device to perform. Being computer illiterate, I need those functions described, using my everyday language. Will someone,...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.