wap to print the sum of the series
s=1+1/4+1/9+1/16+1/25
Attachments:
Answers
Answered by
0
hope it helps u if it then pls mark it brainliest
import java .util.*;
class Series
{
psvm(String args [])
{
Scanner........
int i ,n ;
double s=0.0;
Sopln("enter the no. of terms");
n=sc. nextInt();
for (i=1;i<=n;i++)
s=s+1/i*i;
Sopln(s)
}
}
import java .util.*;
class Series
{
psvm(String args [])
{
Scanner........
int i ,n ;
double s=0.0;
Sopln("enter the no. of terms");
n=sc. nextInt();
for (i=1;i<=n;i++)
s=s+1/i*i;
Sopln(s)
}
}
Similar questions