Computer Science, asked by litikasharma2009, 5 months ago

W.A.P to calculate the following
S =l! + 2 ! +3! +4! ------ n !

Answers

Answered by tharunkrishna1611
1

Answer:

here the code in java

Explanation:

import java.util.Scanner;

public class Series

{

void Fact(int n)

{

int fact =1;

for(int i=1;i<=n;i++)

{

fact=fact*1;

}

return fact;

}

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

Series ser=new Series();

int sum=0;

System.out.println("Enter the range");

int n=sc.nextInt();

for(int i=1;i<=n;i++)

{

sum=sum+Fact(i);

}

System.out.println("The sum of the series is : "+sum);

}

}

Similar questions
Art, 5 months ago