next up previous contents
Next: Solution Up: Control StructureIntrinsics and Previous: Solution

 

Quadratic equation solver

Write a program to read in values of a, b and c and calculate the real roots of the corresponding quadratic equation:

displaymath3262

Point out if the equation only has one or no real roots.

The program should repeatedly expect input; a = 0, b = 0 and c = 0 should be used to terminate.

Hint 1: recall that the solution of a general quadratic equation equation is:

displaymath3263

Hint 2: The program has a single root if

displaymath3264

Go back to Notes gif




next up previous contents
Next: Solution Up: Control StructureIntrinsics and Previous: Solution

©University of Liverpool, 1997
Thu May 29 10:11:26 BST 1997
Not for commercial use.