write a java program to print the series upto 15 terms and also print the value of 'S'....
series is : S = 1/2+1/3+1/4+1/5+1/6........+1/15
Answers
Answered by
3
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);
}
}
Similar questions