recategorized by
1,402 views
1 votes
1 votes

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. $x+x^2/2+x^3/3+x^4/4 + \dots$
  2. $x+x^2/2!+x^3/3!+x^4/4! + \dots$
  3. $1+x^2/2+x^3/3+x^4/4 + \dots$
  4. $1+x^2/2!+x^3/3!+x^4/4! + \dots$
recategorized by

2 Answers

1 votes
1 votes
i=1  ,term =1  , term=1*x/1, sum=0+x/1

i=2,  term=x  , term =x*x/2, sum=x+x^2/2

i=3 term=x^/2 , term =x^3/6, sum =x+x^2/2+x^3/6

and do on

which is better shown by x/1!+x^2/2! +x^/3!+....

so ans is B
0 votes
0 votes
B is answer.

$x+ x^{2}/2! + x^{^{3}}/3! + x^{4}/4!.....$
edited by
Answer:

Related questions

1 votes
1 votes
2 answers
2
6 votes
6 votes
2 answers
3
go_editor asked Aug 8, 2016
3,467 views
How many solutions are there for the equation $x+y+z+u=29$ subject to the constraints that $x \geq 1, \: \: y \geq 2 \: \: z \geq 3 \: \: and \: \: u \geq 0$?496026002375...
2 votes
2 votes
1 answer
4