Computer Science, asked by nitinverma7835, 2 months ago

1) S = 1/x – 2/x2 + 3/x3 – 4/x4 + 5/x5 java program

Answers

Answered by kamalrajatjoshi94
0

Answer:

Program:-

import java.util.*;

public class Series

{

public static void main(String args[ ])

{

Scanner in=new Scanner(System.in);

int x,a;

double s=0.0;

System.out.println("Enter x:");

x=in.nextInt();

for(a=1;a<=5;a++)

{

s=s+(double)a/(Math.pow(x,a);

}

System.out.println("The sum of the given series="+s);

}

}

Similar questions