Here is how this algorithm works step-by-step: Step 1: a = 345 and b = 89 Step 2: 345 ÷ 89 = 3 with remainder 68, so a = b * q + r = 3 * 89 + 78 = 345 Step 3: Since r != 0, go to step 4 Step 4: b = 89, r = 78, go back to step 2 Step 2: 89 ÷ 78 = 1 with remainder 11, so a = b * q + r = 1 * 78 + 11 = 89 Step 3: Since r != 0, go to step 4 Step 4: b= 78, r = 11, go back to step 2 Step 2: 78 ÷ 11 = 7 with remainder 1, so a = b * q + r = 7 * 11 +1 = 78 Step 3: Since r != 0, go to step 4 Step 4: b= 11, r = 1, go back to step 2 Step 2: 11 ÷ 1 = 11 with remainder 0, so a = b * q + r = 11 * 1 + 0 = 11 Step 3: Since r = 0, the algorithm stops and GCD(345, 89) = b = 1.
Here is how this
Step 1: a = 345 and b = 89
Step 2: 345 ÷ 89 = 3 with remainder 68, so a = b * q + r = 3 * 89 + 78 = 345
Step 3: Since r != 0, go to step 4
Step 4: b = 89, r = 78, go back to step 2
Step 2: 89 ÷ 78 = 1 with remainder 11, so a = b * q + r = 1 * 78 + 11 = 89
Step 3: Since r != 0, go to step 4
Step 4: b= 78, r = 11, go back to step 2
Step 2: 78 ÷ 11 = 7 with remainder 1, so a = b * q + r = 7 * 11 +1 = 78
Step 3: Since r != 0, go to step 4
Step 4: b= 11, r = 1, go back to step 2
Step 2: 11 ÷ 1 = 11 with remainder 0, so a = b * q + r = 11 * 1 + 0 = 11
Step 3: Since r = 0, the algorithm stops and GCD(345, 89) = b = 1.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
You are required to use a menu option to allow the user to enter two numbers and find the results as
many times as they want and allow the user to quit when they no longer want to use the system. Use
variables, decision statements, and loops to solve the problem.
It should be pseudocode not python