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:

displaymath2864

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 terminte.

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

displaymath2865

Hint 2: The program has a single root if

displaymath2866




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

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 14:10:26 GMT 1996