Question: Program written in C!!! Create a structure called Fraction to store fractions having numerator and denominator (both of them are integers). Given a command and

Program written in C!!!

Create a structure called Fraction to store fractions having numerator and denominator (both of them are integers). Given a command and a pair of fractions, execute the command using the following functions that you have to implement.

(a) Fraction addition(Fraction a, Fraction b)

(b) Fraction subtraction(Fraction a, Fraction b)

(c) Fraction multiplication(Fraction a, Fraction b)

(d) Fraction division(Fraction a, Fraction b)

Your code should contain a main() function where you will take inputs from a file named input.txt and write outputs to a file named output.txt. All your inputs will be valid fractions, so no need to check for divide by zero error.

 Program written in C!!! Create a structure called Fraction to store

Input Format The first line contains a single integer T, denoting the number of test cases. (1 denominator, separated by a space. The possible commands are Command Instruction Example input Example output Explanation Add the two fractions1 2 1 4 1/2+ 1/43/4 Subtract the second fraction from the first fraction 3 41 2 3/4-1/2 1/4 Multiply the two fractions 5 10 147 1 2 3 4 1/23/4-2/3 Divide the first fraction by the second fraction All resulting fractions should be in their reduced form e.g.: 5/10 1/10 6/10 After reduction, the result is 3/5 Sample Input Sample Output 4 a 1 2 5 10 s 1 2 1 10 m 1 6 3 4 d 1 82 32 2 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!