f2prateek wrote:
> I need to calculate the roots of a quadratic equation by formula.But
> how do I use the math.sqrt thing?
Do a google search on java math.sqrt The first link will give you the
class definition which you can use. Basically, this should be in the
comp.lang.java.help newsgroup as it is pretty much rank beginner stuff,
and that group is more for people just getting started with java.
However, giving you the fish as well as teaching you to fish, code
like:
double a, b, c, root1, root2;
a = 1;
b = 4;
c = 7; //picked random numbers
root1 = ((-1 * b) + (Math.sqrt((b * b) - (4 * a * c))) / (2 * a);
root2 = ...
|