Solutions for Class 10 ICSE Logix Kips Computer Applications with BlueJ Java | IT Developer <?php echo $page_title; ?>
IT Developer

Iterative Constructs in Java

Chapter 9

Iterative Constructs in Java

Class 10 - Logix Kips ICSE Computer Applications with BlueJ


Share with a Friend

Java Program: Sum of Fraction Series 1/2 + 2/3 + ... + 49/50


30(iv). Write a program in Java to find the sum of the given series:

 

\[ \dfrac{1}{2} + \dfrac{2}{3} + \dfrac{3}{4} + ... + \dfrac{49}{50} \]

Program Title: Sum of Fraction Series 1/2 + 2/3 + … + 49/50

public class FractionSeriesSum {

    public static void main(String[] args) {

        double sum = 0.0;

 

        for (int i = 1; i <= 49; i++) {

            sum += (double) i / (i + 1);

        }

 

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

    }

}

Output

Sample Output
Sum of the series is: 39.59259259259259 

📝 Explanation

  1. Loop from i = 1 to 49
  2. Each term = i / (i + 1)
  3. Sum all terms in sum
  4. Print the final sum