Question: In C programming You are to write a C program that reads fractions and prints each fraction reduced to its lowest terms. The output of
In C programming
You are to write a C program that reads fractions and prints each fraction reduced to its lowest terms.
The output of your program is to look like this where the user input is shown in green.
Note that a fraction may be negative. Fraction: 3/6 reduced = 1/2 Fraction: -12/16 reduced = -3/4 Fraction: 11/19 cannot be reduced Fraction: quit Notes: 1. Your program is to define a type called fraction which is a structure containing two integers: the numerator and the denominator. 2. The input is terminated by entering any nonnumeric (as shown in the sample output). 3. Your program is to have a recursive function called GCF for finding the greatest common factor (aka greatest common divisor) of two integers. 4. Your program is to have a function called reduce for reducing a fraction to its lowest terms. 5. The GCF of two positive integers x and y is given by x if y is 0, the GCF of y and x%y if y>0 . All input and output is to be done in your main program so you must use a suitable mechanism for your function reduce to signal when a fraction is not reducible.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
