import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double x;
System.out.print("x=");
x = sc.nextDouble();
sc.close();
System.out.println("result:");
if (x < -3 || x > 1) {
System.out.println("error");
return;
}
double s, a;
int i;
s = (double)1/3;
a = 1;
i = 9;
while(Math.abs(a/i)>0.0001) {
a=-a((x+2)(x+2));
s=s+(a/i);
System.out.println(s);
i=i3;
}
System.out.printf("function=%.4f", 1/(((xx)+(4*x)+7)));
System.out.printf("\nsumma=%.4f", s);
}
}
It works for -3,-2,-1 but for 0 and 1 it’s infinite NaN so,what to do ?
Under discussion
Comments
- Popular
- New
- Old
You must be signed in to leave a comment
This page doesn't have any comments yet