WAP in java to input number and print the given series and its sum: 2!/1 + 3!/2 + 4!/5 + 5!/6 + ......nth term
Answers
Answered by
0
import java.util.*;
public class series
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int i,j,n,f;
double s=0.0;
System.out.println("enter limit = ");
n= in.nextInt();
for(i=1;i<=n;i++)
{
f=1;
for(j=1;j<=(i+1);j++)
{
f=f*j;
}
s=s+(f/(i*1.0));
}
System.out.print("Sum = "+s);
}
}
Similar questions