Pure Programmer
Blue Matrix


Cluster Map

Project: Quadratic Roots (Command Line)

Quadratic equations of the form Ax2 + Bx + C = 0 have two possible solutions given by the [[Quadratic Formula]]. Write a program that prints the two possible roots of a quadratic equation. Then values A, B and C should be passed in on the command line.

See: QuadraticRoots

Output
$ node QuadraticRootsCmdLine.js 2 4 1 root #1: -0.2928932188134524 root #2: -1.7071067811865475 $ node QuadraticRootsCmdLine.js 1 -3.3 2.42 root #1: 2.1999999999999997 root #2: 1.1

Solution