FUNCTION MCD(X,Y) 1. WHILE (X <> Y) a. IF (X>Y) THEN 1. X <- XY b. ELSE 1. Y <- Y-X 1. RETURN (X) END FUNCTION

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 12PE
icon
Related questions
Question

Given the following pseudocode of the GCF (greatest common divisor), calculate the greatest common divisor of 190 and 34. Use a table where the columns are: X, Y, X - Y, Y - X

FUNCTION MCD(X,Y)
1. WHILE (X > Y)
a. IF (X>Y) THEN
1. X <- XY
b. ELSE
1. Y <- Y-X
1. RETURN (X)
END FUNCTION
Transcribed Image Text:FUNCTION MCD(X,Y) 1. WHILE (X > Y) a. IF (X>Y) THEN 1. X <- XY b. ELSE 1. Y <- Y-X 1. RETURN (X) END FUNCTION
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning