Consider the following program: #include<stdio.h> main() { int i, inp; float…

Consider the following program:

#include<stdio.h>

main()

{

int i, inp;

float x, term=1, sum=0;

scanf("%d %f", &inp, &x);

for(i=1;i<=inp;i++)

{

term=term*x/i;

sum=sum+term;

}

printf("Result=%f\n", sum);

}

The program computes the sum of which of the following series?

  1. A.

    x+x2/2+x3/3+x4/4+…x+x^2/2+x^3/3+x^4/4 + \dots

  2. B.

    x+x2/2!+x3/3!+x4/4!+…x+x^2/2!+x^3/3!+x^4/4! + \dots

  3. C.

    1+x2/2+x3/3+x4/4+…1+x^2/2+x^3/3+x^4/4 + \dots

  4. D.

    1+x2/2!+x3/3!+x4/4!+…1+x^2/2!+x^3/3!+x^4/4! + \dots

Attempted by 139 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…