// header files #include #include #include #include // local constants #define QUADRATIC_A 2 #define QUADRATIC_B -4 #define QUADRATIC_C -3 /* Name: Quadratic Formula Root Finder Process: Function input/parameters: NONE Function output/parameters: NONE Function output/returned: NONE Device input/---: NONE Device output/---: NONE Dependencies: included by standard libraries */ int main() { // define local variables double positiveRoot, negativeRoot; // do calculations positiveRoot = (-QUADRATIC_B + sqrt((QUADRATIC_B * QUADRATIC_B) - (4 * QUADRATIC_A * QUADRATIC_C))) / (2*QUADRATIC_A); negativeRoot = (-QUADRATIC_B - sqrt((QUADRATIC_B * QUADRATIC_B) - (4 * QUADRATIC_A * QUADRATIC_C))) / (2*QUADRATIC_A); // display results printf("The roots of the quadratic %dx^2 + %dx + %d are: %f & %f.\n", QUADRATIC_A, QUADRATIC_B, QUADRATIC_C, positiveRoot, negativeRoot); // return success return 0; }