Question: 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
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
