# Algorithms | Misc | Question 7

Consider the following C function.

 `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;  ` `}    `

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

Explanation: The function f() is implementation of Taylor’s Series to calculates e^x

```   e^x = 1 + x + x^2/2! + x^3/3! + ---
```

More is the value of y more precise value of e^x will be returned by f()

Quiz of this Question

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Previous
Next