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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started