The following function computes the value of mCn correctly for all legal…

PYQ GATE 2006

The following function computes the value of

mCn

correctly for all legal values m and n (m≥1,n≥0 and m>n)

 int func(int m, int n)
{
    if (E) return 1;
    else return(func(m -1, n) + func(m - 1, n - 1));
}

In the above function, which of the following is the correct expression for E?

  1. A.

    (n = = 0) || (m = = 1)

  2. B.

    (n = = 0) && (m = = 1)

  3. C.

    (n = = 0) || (m = = n)

  4. D.

    (n = = 0) && (m = = n)

Attempted by 253 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…