ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2007 ICSE Computer Science Paper



Share with a Friend

Solved 2007 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Sum of Series Program - ICSE 2007 Computer Science

Write a program to compute and display the sum of the following series:

import java.io.*; class Series{ public static void main(String args[])throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("N = "); int n = Integer.parseInt(br.readLine()); double sum = 0.0; for(int i = 2; i <= n + 1; i++){ int p = 1; double s = 0; for(int j = 1; j <= i; j++){ p *= i; s += i; } sum += s / p; } System.out.println("Sum = " + sum); } }

Output

 
 OUTPUT  : 
N = 10
Sum = 1.404668597605295