Question: Write two static functions that each take two integer parameters, one that calculates and returns the least common multiple of those two values and the

Write two static functions that each take two integer parameters, one that calculates and returns the least common multiple of those two values and the other that calculates and returns the greatest common divisor of the two. The main method will ask the user for the two inputs and then output the results from each method call. The user also should be given the option of inputting a new set of numbers. The least common multiple is the smallest value that both numbers divide into. Such as the LCM(12,15) = 60. Algorithm for calculating the LCM can be done easiest by calculating the greatest common divisor first as there is a simple relationship between the two. Calling the GCD method from inside the LCM method is required. To calculate the GCD; the Euclidean Algorithm can do this and is defined on many places on the web. Do not use the recursive method from the book. Do not copy directly from outside source and do not look for an already made method in the JAVA API.

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!