next up previous
Next: Arrays Up: Control StructureIntrinsics and Previous: Point on a circle

 

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:

displaymath2959

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:

displaymath2960

Hint 2: The program has a single root if

displaymath2961


next up previous
Next: Arrays Up: Control StructureIntrinsics and Previous: Point on a circle

Adam Marshall ©University of Liverpool, 1996
Wed Oct 9 17:39:48 BST 1996