7. แถวลำดับ

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 7-18  เมท็อดหารากของสมการ ax2 + bx + c = 0 (แบบที่ 2)
  public static double[] quadraticRoot(double a,double b,double c){
    double t = Math.sqrt(b*b - 4*a*c);  
    double[] root = new double[2];
    root[0] = (-b + t)/(2*a);
    root[1] = (-b - t)/(2*a);
    return root;
  }
©2009 S.Prasitjutrakul