Computer Science, asked by Janhvi750, 9 months ago

Java program to display the output of following series
 \sf \: sum \:  =  \frac{1 + 2}{1 \times 2}  +  \frac{1 + 2 + 3}{1 \times 2 \times 3}  + .......  + \frac{1 + 2 + 3...n}{1 \times 2 \times 3...n}

Answers

Answered by Anonymous
2

import java.util.Scanner;

public class Series {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.println("Enter the value of x : ");

double x = scanner.nextDouble();

double sumOfSeries = 0;

double numerator = x;

double denominator;

double term;

for(int i = 2; i <= 100; i = i + 3) {

denominator = i;

term = numerator / denominator;

sumOfSeries = sumOfSeries + term;

}

System.out.println("Sum of the series : " + sumOfSeries);

}

}

Kya ho re hn ?? smj nhi aya muje

Similar questions