The following program computes values of a mathematical function f(x).…

PYQ GATE 1990

The following program computes values of a mathematical function f(x). Determine the form of f(x).

main ()
{
  int m, n; float x, y, t;
  scanf ("%f%d", &x, &n);
  t = 1; y = 0; m = 1;
  do
  {
    t *= (-x/m);
    y += t;
  } while (m++ < n);
  printf ("The value of y is %f", y);
}

Attempted by 1 students.

Sign up free to check your answer

Sign up free

Explore the full course: Algorithms

Loading lesson…