返回列表 發帖
  1. public class JPA01 {
  2.    
  3.         public static void main(String[]args) {
  4.                
  5.                 f(-3.2);
  6.                 System.out.println("");
  7.                 f(-2.1);
  8.                 System.out.println("");
  9.                 f(0);
  10.                 System.out.println("");
  11.                 f(2.1);
  12.                
  13.                
  14.                
  15.         }
  16.         public static void f ( double x ) {
  17.                
  18.                 float result = (float)(3*(Math.pow(x,3)+2*x-1));
  19.                
  20.                 System.out.printf("f(%f) = %.4f",x,result);
  21.                

  22.         }
  23. }
複製代碼

TOP

返回列表