Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your main program should be very simple. It should read two integers in from the user (first the numerator, then the denominator) and output the
- Your main program should be very simple. It should read two integers in from the user (first the numerator, then the denominator) and output the simplified fraction for those values.
- For example, if the input is 3 followed by -6, then your program would output -1/2.
- If the denominator, after simplifying the fraction is 1, simply output the numerator, e.g. 5/1 should output as 5.
- If the denominator is zero, output NaN. This is a common symbol that means "not a number" since dividing by zero is not allowed in mathematics.
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