...
Programming-for-Output-Problems
October 6, 2023
Programming-for-Output-Problems
October 6, 2023
Programming-for-Output-Problems
October 6, 2023
Programming-for-Output-Problems
October 6, 2023

Programming-for-Output-Problems

Question 31
Assume A and B are non zero positive integers. The following code segment

A
Computes the LCM of two numbers
B
Divides the larger number by the smaller number
C
Computes the GCD of two numbers
D
Finds the smaller of two numbers
Question 31 Explanation: 
→ The above iterative code is computes the GCD of two numbers using euclidean algorithm.
→ The procedure is to subtract smaller number from larger. So that we can reduce larger number then doesn’t change the value of GCD.
→ if we performing number of iterations based on condition the larger of two numbers will end up with GCD.
Correct Answer: C
Question 31 Explanation: 
→ The above iterative code is computes the GCD of two numbers using euclidean algorithm.
→ The procedure is to subtract smaller number from larger. So that we can reduce larger number then doesn’t change the value of GCD.
→ if we performing number of iterations based on condition the larger of two numbers will end up with GCD.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!