Assume that X and Y are non-zero positive integers. What does the following…
GATE · 1995 · CS · Question 2 subparts
Assume that X and Y are non-zero positive integers. What does the following pascal program segment do?
while X <>Y do
if X > Y then
X:=X − Y
else
Y:=Y − X;
write(X);- A.
Computes the LCM of two numbers
- B.
Divides the larger number by the smaller number
- C.
Computes the GCD of two numbers
- D.
None of the above
Attempted by 2 students.
Sign up free to check your answer
Sign up freeLoading lesson…