Question: This assignment will require you to do arithmetic in C involving multiple conditional paths and multiple functions separating out parts of the code. Specifically, your

This assignment will require you to do arithmetic in C involving multiple conditional paths and multiple functions separating out parts of the code. Specifically, your assignment is to write a program implementing the quadratic formula. Start with three floating point variables named a, b and c. Prompt the user for each of them as we have shown how to do in class, and accept them as input. You will then compute the roots x1 and X2, and printf them out as part of an appropriate message. However, you've got three complications to deal with: In certain cases, quadratic equations have only one root. In that case you should print out only that one root. In certain cases, quadratic equations have one or more complex roots. In that case you should print out both the real and imaginary part of the roots. The quadratic formula is invalid if a = 0. You may simply print an error in this case. I also require the following: Do no arithmetic in main(). Create functions that do all your math. Declare a, b and c in main() - along with any other variables you need. Pass your a, b, and c values to your functions, and results back from your functions. Do not use any global variables. You must specifically use a function to compute the discriminant - the part of the quadratic under the square root. . (Hint: This can also help you figure out when you have complex roots!) o The discriminant function should have the following header: double discriminant(double a, double b, double c) Comment every function, every "paragraph" of code as we discussed in class, and any line of code that does more than two things. Indent your code properly. Your editor will do this for you! Let it. Here's one hint: Include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
