Question: Q6. Design an algorithm and write its C++ code. It takes two positive integer arguments, call them,m and n, treats them as the numerator and

 Q6. Design an algorithm and write its C++ code. It takes

Q6. Design an algorithm and write its C++ code. It takes two positive integer arguments, call them,"m" and "n", treats them as the numerator and denominator of a fraction, and reduces the fraction. That is to say, each of the two arguments will be modified by dividing it by the greatest common divisor of the two integers. The function should return the valuen (to indicate failure to reduce) if either of the two arguments is zero or negative, and should return the value 1 otherwise. Thus, for example, ifm' and 'n' have been declared to be integer variables in a program, then. Thus, for example: m = 63; n = 210; will produce and print 3/10' m = 25; n = 0; will produce and print Fractional Error' Keep your code commented and indented for ease of reading. Paste your commented codes in the solution and also add a clear screen shot of outcome in your solution: (3.0-Mark)

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!