print the series in java: 1/2+2/9+4/28+8/65....n terms
Answers
Answered by
0
class xyz
{
public void display(int n)
{
int m=2,j=1,t=2,i,k;
double s=0;
for(i=1,k=1;k<=n;i=i*2,k++)
{
s+=i/(m*j);
if(k!=n)
{ System.out.print(i+"/"+(m*j)+"+");}
else
{System.out.println(i+"/"+(m*j));}
m++;
j=j+t;
t=t+2;
}//end of for loop
System.out.println("SUM OF SERIES IS"+s);
}//end of function
}//end of class
Similar questions