Write a program to find the sum of the series:
s= 1+(1*2)+(1*2*3)+......................(1*2*3*4*.....................*n)
Answers
Answered by
2
import java.util.*;
public class Series
{
public static void main(String args[])
{
Scanner in =new Scanner(System.in);
int a,n,p=1,s=0;
System.out.println("Enter the value of n");
n=in.nextInt();
{
p=p*a;
s=s+p;
}
System.out.println("The sum of the series is="+s);
}
}
Answered by
0
Answer:
class Harmonic
{
public static void main(String…s)
{
int n,i;
float sum=0;
n=Integer.parseInt(s[0]);
for(i=1;i<=n;i++)
{
sum=sum+(float)1/i;
}
System.out.println(“nSum=”+sum);
}
}
Explanation:
Hope the above answer helps you. The above answer contains the correct information about your question. Please mark my answer as the brainliest and say thanks for the answer. Follow me
Similar questions
Social Sciences,
6 months ago
English,
6 months ago
Social Sciences,
6 months ago
Math,
11 months ago
CBSE BOARD X,
11 months ago
English,
1 year ago