Skip to content
Related Articles

Related Articles

Algorithms | Recursion | Question 5
  • Difficulty Level : Easy
  • Last Updated : 29 Aug, 2013
GeeksforGeeks - Summer Carnival Banner

What does fun2() do in general?




int fun(int x, int y)
{
    if (y == 0)   return 0;
    return (x + fun(x, y-1));
}
  
int fun2(int a, int b)
{
    if (b == 0) return 1;
    return fun(a, fun2(a, b-1));
}

(A) x*y
(B) x+x*y
(C) xy
(D) yx


Answer: (C)

Explanation: The function multiplies x to itself y times which is xy.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :