id/email
password
forgot password
about | help | done | prefs | create account
JavaBat java practice problems

quadratic

Recall the quadratic formula -b + sqrt(b^2 - 4 a c) / 2a. (Here, b^2 is the square of b - though ^ doesn't work this way in Java!) Given a, b, and c, compute the value of the quadratic formula. You can use Math.sqrt(x) to compute x's square root.

quadratic(1, 2, -3) → 1.0
quadratic(1, 0, -4) → 2.0
quadratic(2, 5, 3) → -1.0

...Save, Compile, Run         

See Also: Example Code Java help: If Boolean Logic | Strings | While and For Loops | Arrays and Loops

Forget It! -- delete my code for this problem 140

Copyright Nick Parlante 2006-09 - privacy