Computer Science, asked by sunitazirange, 10 months ago

Write a java program to print the series and also the sum of series
S=1/2+1/3+1/4+1/5+1/6+1/7+1/8+1/9+1/10+1/11+1/12+1/13+1/14+1/15
Example - S = 2.31822899323



Answers

Answered by Anonymous
1

Explanation:

class Series

{

public static void main(String args[])

{

double s=0;

System.out.print("S=");

for(int i=1;i<=14;i++)

{

System.out.print("1/"+(i+1)+"+");

s=s+1.0/(i+1);

}

System.out.print("\b");

System.out.print("="+s);

}

}

Attachments:
Similar questions