To find the sum of the factorial series


 

Write a program in java to find the sum of the given series:

X= 1+1/2! + 1/3!  +1/4!+…………………….+1/10!


class factseries

{

public static void main(String arg[])

{

double x=1;

int a,b;

float f1;

for(a=0;a<=10;a++)

{

f1=1;

for(b=1;b<=a;b++)

f1=f1*b;

x=x+1/f1;

}

System,out.println(“The sum of the series=”+x);

}

}

Related Posts

Comments are closed.