Lab Exercise

 

Quadratic

 

 

 

Assignment:

 

1.   Write a program to input the coefficients of a, b, and c for a quadratic equation.  Remember that a quadratic equation can be summarized in the form:

 

            ax2  +  bx  +  c  =  0

 

      The program should compute the two roots for the equation.

 

            x =

 

2.   Your two answers should be printed out to 4 decimal places, + 0.0001.

 

3.   You do not have to error-trap for a negative determinate situation (if b2 - 4ac < 0).  All the test inputs will result in real-number answers.

 

 

Instructions:

 

1.   Write your program, test it, and then run these 3 sample inputs:

 

      x2 - x - 6 = 0                      x2 + x -   =  0                    -2x2 + 5x + 17 = 0

 

2.   Here are decimal equivalencies to use for inputs to the middle problem:

 

          =  0.125; -   =  - 0.03125;

 

3.   Turn in your source code and run output.