Functions
October 18, 2024
Switching
October 18, 2024
Functions
October 18, 2024
Switching
October 18, 2024

Functions

Question 18
int function (int x, int y)
{
 if(y<=0) return x;
 return function (y, x%y);
} 

The above recursive function computes ______

A
GCD of X and Y
B
xy
C
yx
D
HCF of x and y
E
Both A and D
Question 18 Explanation: 
Let’s take x=3, y=5
Correct Answer: E
Question 18 Explanation: 
Let’s take x=3, y=5

Leave a Reply

Your email address will not be published. Required fields are marked *