Math, asked by sunitazirange, 1 year ago

write a java program to print the series:
S=1/2+1/3+1/4...............+1/15
and i also want to print the value of 'S' in the same java program

Answers

Answered by Anonymous
2

Step-by-step explanation:

class Sum_series

{

public static void main(String args[])

{

double s =0;

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

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

{

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

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

}

System.out.print("\n"+s);

}

}

Similar questions