Homework 10 - UMBC-CMSC104/General GitHub Wiki

We're going to be working with the quadratic formula for this assignment. Please name your source file quadratic.c.

Please look over the Wikipedia entry for the quadratic formula first.

You are to write a program that prompts the user for 3 values, a, b, and c. It should then print out the proper numbers of roots for the values supplied.

For example:

Welcome to the quadratic formula calculation.
Please enter a: 1
Please enter b: 3
Please enter c: -4
There are two roots to this equation: -4, and 1

Or:

Welcome to the quadratic formula calculation.
Please enter a: 9
Please enter b: 12
Please enter c: 4
There is one root to this equation: -0.666667

Or:

Welcome to the quadratic formula calculation.
Please enter a: 3
Please enter b: 4
Please enter c: 2
There are no roots for this equation.

Requirements

  • Your quadratic formula must be a separate function from main. It should take in 3 doubles and return nothing. It should also print out the number of roots and what they are.

Notes

  • You will most likely have to look at the discriminant to determine the number of roots. Please refer to the discriminant section on the Wikipedia page.

To submit this:

submit cs104_wilson hw10 quadratic.c