code in C please
Assignment We continue to write programs to help middle schoolers do their math homework. This time we'll help them with the qwadratic formula In algebra, a quadratic equation is usually written in the form: y - ax+ b Students are often asked to find the roots of the quadratic equation. That is, find the values of x that make y zero. These roots (if they exist) are easily found using the quadratic formula. which you will use in your program Your program should query the user for the constants a, b and c then output the values of the two roots. Your program should print out the "work" so a middle schooler can just copy the output of your program for hisher homework. A sample run of your program should look like the following. (The user's responses are in orange) PTI10318 geo -Wal1 quad. PTI 104 ]* ./a . out Specify your quadratie eguation in the forsi y - bx Enter bi Enter et 1. Please name your C program quad. 2. Remember that you must declare a variable before you use it. For this program, all of your variables should have type double. 3. To square the variable b, just use b b. 4. You will need to use the sqreoi function from the math library. Her's an example shown the discriminant, assuming you have the discriminant stored in a double variable called dise). 5. Remember that when you use functions from the math library, you need to have: in class: See math.c on blackboard. (Basically, just use eqrtt disc ) when you want to calculate #include
program. You will also need to use the In option when you compile (thar's the leter and not the digit 1) gce -wal1 quad.e-1m 6. If the quadratic equation specified by the user does not have any roots, your program will print out nan when you try to take the square root of a negative discriminant Here nan means "not a number". Your program should print out something more helpful like The diseriminant is negative, your quadratie equation has no roots 7. Implement your program in steps. So, you always have a working version that does something. For example, you can compile, run and debug your program after each of the following step o First make sure that your program can correctly get input from the user. Have your program print out the variables for a, b and c even though the assignment doesn't ask for this. Calculate the discriminant. Store it in a variable. Print out the value of the discriminant. Check that it is correct o Print out the work for the discriminant Calculate rootl. Check that you have the right value. o Print out the work for rootl Calculate and print out root2 o Print out the work for "checking your answer" for rootl Print out the work for "checking your answer for root2. This is a sizable program, but none of the steps are very complicated. If you type in the entire program in one siting and try to messages and have a tough time finding your bugs. If you compale and debug after implementing a small part of the program, you know compile it, you might get dozens of wamings andlor error that the bg is in the few lines that you just yped in