Question: IE 2 3 0 5 Looping and Function Practice a ) The Least Common Multiple ( LCM ) of two positive integers A and B

IE 2305
Looping and Function Practice
a) The Least Common Multiple (LCM) of two positive integers A and B is the smallest positive integer that is divisible by both A and B. The Greatest Common Divisor (GCD) of two positive integers A and B is the largest integer ?bar(C) that divides evenly into both A and B. If you know either LCM or widehat(GCD), you can easily calculate the other using: (:A**B=LCM(A,B)**subr?bar(n)????R}
b) Write a Sub that asks the user for two positive integers using input boxes. The code should then call a function that finds either LCM or GCD (your choice). The sub should then calculate the one your function didn't find using the formula given in the last sentence of part a. The code should then output onto a worksheet A, B, LCM, and GCD, with headers. Each time the user runs the sub, the new numbers should go directly under the previous run. In the screenshot below, the Sub was run 3 times. The first time rows 1 and 2 are populated. The second time, row 3(and 1 is overwritten) are populated. The third time row 4(and 1).
c) Write either a LCM or GCD function, whichever is easier for you. The function you write will be the one you call in your Sub from part b.
d) Here are some correct answers so that you will know when you are on the right track. I ran the sub 3 times to get this result.
 IE 2305 Looping and Function Practice a) The Least Common Multiple

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 General Management Questions!