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
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
Business Studies,
6 months ago
Social Sciences,
6 months ago
Math,
1 year ago
Sociology,
1 year ago
Math,
1 year ago