id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

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 (ctrl-enter)

public double quadratic(double a, double b, double c) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 140

Copyright Nick Parlante 2017 - privacy