CMPSC 101 LAB 10 – Loops and LCM Solution

CMPSC 101 LAB 10 – Loops and LCM Solution

Write a program that asks the user for two numbers, then looks for the least common multiple. For a refresher on what a least common multiple is, see:
http://www.math.com/school/subject1/lessons/S1U3L3GL.html
If the program does not find one by 100, stop looking. For example:
Enter a number: 3
Enter another number: 4
2? no. 3? no. 4? no. 5? no. 6? no. 7? no. 8? no. 9? no. 10? no.
11? no. 12? yes!
You do not have to worry about how the answer wraps on the screen. Feedback?
Another example:
Enter a number: 97
Enter another number: 51
2? no. 3? no. 4? no. 5? no. 6? no. 7? no. 8? no. 9? no. 10? no. 11? no.
12? no. 13? no. 14? no. 15? no. 16? no. 17? no. 18? no. 19? no. 20? no.
21? no. 22? no. 23? no. 24? no. 25? no. 26? no. 27? no. 28? no. 29? no.
30? no. 31? no. 32? no. 33? no. 34? no. 35? no. 36? no. 37? no. 38? no.
39? no. 40? no. 41? no. 42? no. 43? no. 44? no. 45? no. 46? no. 47? no.
48? no. 49? no. 50? no. 51? no. 52? no. 53? no. 54? no. 55? no. 56? no.
57? no. 58? no. 59? no. 60? no. 61? no. 62? no. 63? no. 64? no. 65? no.
66? no. 67? no. 68? no. 69? no. 70? no. 71? no. 72? no. 73? no. 74? no.
75? no. 76? no. 77? no. 78? no. 79? no. 80? no. 81? no. 82? no. 83? no.
84? no. 85? no. 86? no. 87? no. 88? no. 89? no. 90? no. 91? no. 92? no.
93? no. 94? no. 95? no. 96? no. 97? no. 98? no. 99? no. 100? no. Gave up!
Run it 5 times with different data, including the two above examples.
Then, following the instructions in the “How to package and submit your labs” video, package up your work. Double check to confirm that the package is complete (i.e., all the header info, the code, the screen shots, the output, etc.), and then submit it to the drop box.
Next, go back and confirm that the submission is in the drop box!
Powered by