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

  1. 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.
    1. For example, if the input is 3 followed by -6, then your program would output -1/2.
  2. If the denominator, after simplifying the fraction is 1, simply output the numerator, e.g. 5/1 should output as 5.
  3. 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 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!