Write a java program to print the 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 and also find the value of 'S'. plzzzz answer fast!!!
i am answering this third time
plz answer it!
i want it urgent!
Answers
Answered by
0
PROGRAM CODE
import java.util.*;
class series
{ public static void main(String args[])
{Scanner sc=new Scanner(System.in);
int i;
double f=0.0,s=1/2;
System.out.print("1/2");
for(i=2;i<15;i++)
{ f=1/(i+1);
System.out.print( "+" + f);
s=s+f;}
System.out.println(s);
}
}
VARIABLE DESCRIPTION
i- It is used for iteration.
f- It is used to find the fraction.
s- It is used to find the sum of the series.
Similar questions