WAP in java bluej to find sum of (1/1+2)+(1/1+2+3)+(1/1+2+3+4)+(1/1+2+3+4+5)
Please.... Help
Answers
Answered by
4
Hey friend!!
Here's the program.....
import java.io.*;
class sum
{
public static void main(String args[])throws IOException
{
InputStreamReader x= new InputStreamReader(System.in);
BufferedReader y= new BufferedReader(x);
double s=0, i,n=1;
for( i= 2; i<=5;i++)
{
s=n/(n+i)+s;
}
System.out.println("Sum of the series="+s);
}
}
I hope it helps....
Here's the program.....
import java.io.*;
class sum
{
public static void main(String args[])throws IOException
{
InputStreamReader x= new InputStreamReader(System.in);
BufferedReader y= new BufferedReader(x);
double s=0, i,n=1;
for( i= 2; i<=5;i++)
{
s=n/(n+i)+s;
}
System.out.println("Sum of the series="+s);
}
}
I hope it helps....
PuneetNK:
Thank u sooooo much... It really helped me
Similar questions