ICSE Class 10 Computer Applications Question 38 of 69

Iterative Constructs in Java — Question 38

Back to all questions
38
Question

Question 30(v)

Write a program in Java to find the sum of the given series:

11+22+33+...+1010\dfrac{1}{\sqrt{1}} + \dfrac{2}{\sqrt{2}} + \dfrac{3}{\sqrt{3}} + ... + \dfrac{10}{\sqrt{10}}

public class KboatSeries
{
    public static void main(String args[]) {    
        double sum = 0;
        for (int i = 1; i <= 10; i++)
            sum += i / Math.sqrt(i);
        System.out.println("Sum = " + sum);
    }
}
Output
BlueJ output of KboatSeries.java
Answer