Computer Science, asked by hhhhyyrfft, 9 months ago

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 Anonymous
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 mustafa3952
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