Question: Chapter 4 in C + + Write a program that reduces a fraction to lowest terms. Two functions should be implemented. Function gcd should find
Chapter
in C Write a program that reduces a fraction to lowest terms. Two functions should be implemented. Function gcd should find and return the greatest common denominator and be called as g gcdnumden; Function reducenumden; should call gcd to provide the lowest terms. The lowest terms should be returned via reference in num and den.
Pseudo code for gcd is:
function gcda b
while b
t b
b a mod b
a t
return a
Example Output:
This program takes a numerator and denominator and reduces to lowest terms
Enter the numerator
Enter the denominator
greatest common denominator is
your fraction reduced is
Try Again? yes, exit
Enter the numerator
Enter the denominator
greatest common denominator is
your fraction reduced is
Try Again? yes, exit
Enter the numerator
Enter the denominator
greatest common denominator is
your fraction reduced is
Try Again? yes, exit
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
