write a program to find the sum of the series:
s = a- a/2+a/3-a/4..............-a/20
Answers
Answered by
13
import java.util.*;
public class Series
{
public static void main(String args[])
{
Scanner in= new Scanner(System.in);
double a,n,s=0;
System.out.println("Enter the value of n");
n= in.nextDouble();
for(a=1;a<=n;a++)
s=s+1.0/Math.pow(2,a);
System.out.println("The sum of the series is="+s);
}
}
Answered by
2
➡️⏩➡️⏩➡️⏩➡️⏩➡️⏩➡️⏩
programme for this series ,
refer to attachment
Attachments:
Similar questions