public class JPA106 {
public static void main(String []argv){
System.out.printf("f(-3.2)=%.4f\n",f(-3.2));
System.out.printf("f(-2.1)=%.4f\n",f(-2.1));
System.out.printf("f(0)=%.4f\n",f(0));
System.out.printf("f(2.1)=%.4f\n",f(2.1));
}
public static double f(double x){
return 3*(x*x*x)+2*x-1;
}
}
沒有留言:
張貼留言