Question: Program in C Q2: Write a function named ConvertToLowestTerms that inputs two integer parameters by reference named numerator and denominator. The function should treat these

Program in C

Program in C Q2: Write a function named ConvertToLowestTerms that inputs two

Q2: Write a function named ConvertToLowestTerms that inputs two integer parameters by reference named numerator and denominator. The function should treat these variables as a fraction and reduce them to lowest terms. For example, if numerator is 20 and denominator is 60 then the function should change the variables to 1 and 3 respectively. This will require finding the greatest common divisor for the numerator and denominator, then dividing both variables by that number. If the denominator is zero the function should return false, otherwise the function should return true. Write a test program that uses ConvertToLowestTerms to reduce and output several fractions. (2 marks)

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!