GATE | GATE-CS-2003 | Question 1

Consider the following C function.

filter_none

edit
close

play_arrow

link
brightness_4
code

float f(float x, int y)
{
  float p, s; int i;
  for (s=1, p=1, i=1; i < y; i ++)
  {
    p*= x/i;
    s+=p;
  }
  return s;
}  

chevron_right


For large values of y, the return value of the function f best approximates
(A) x^y
(B) e^x
(C) ln(1 + x)
(D) x^x


Answer: (B)

Explanation: See question 1 of https://www.geeksforgeeks.org/data-structures-and-algorithms-set-5/

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.