Question: Write a C program that implements fraction numbers. Your structure should have two fields: numerator and denominator. Remember that a denominator should never be 0.

Write a C program that implements fraction numbers. Your structure should have two fields: numerator and denominator. Remember that a denominator should never be 0.

You need to implement the following operations:

Add two fractions

Subtract two fractions.

Multiply two fractions

Divide two fractions.

You need to implement a function for each one of these operators.

You main function will need to call these functions.

You main function will have an infinite loop with the following menu:

Add two fractions

Subtract two fractions.

Multiply two fractions

Divide two fractions. (you can do it at Home)

Quit

You would need to ask the user to input both the numerator and the denominator and ask the user for the operation number (1 for add, 2 for sub, 3 for mult, and 4 for div). The program then prints the outcome of the operation.

The infinite loop will terminate if the user input 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!