PPT Slide
/* Calculate the roots */
darg = (double) (b * b - 4.0 * a * c);
ds = Math.sqrt(darg);
denom = 2.0 * a;
dmb = (double) (- b);
root1 = ( dmb + ds) / denom;
root2 = ( dmb - ds) / denom;
System.out.println("root1 is " + root1);
System.out.println("root2 is " + root2);
}
}
>Java MyRoots 1 -10 25
a = 1; b = -10; c = 25
root1 is 5.0
root2 is 5.0
Previous slide
Next slide
Back to first slide
View graphic version