Question: PLEASE HELP! I have my program practically completed, I just need help with one thing! The program is pretty self explanatory and I have my
PLEASE HELP! I have my program practically completed, I just need help with one thing! The program is pretty self explanatory and I have my code provided below.
My issue is when I go to my output screen, I get the "nan" error because of using the sqrt function on a negative number. However, I only receive this error when the input is 0, and the output becomes -0. I need all the "nan" errors to return as zeros, not negative zeros.
Where is the issue in my code? how come it can sqrt negative integers perfectly fine, but it gives an error when a zero is put into the input?
ALL OF THE PROVIDED SAMPLE INPUTS WORK PERFECT! I ONLY RECIEVE AN ERROR WHEN 0, 0, 0 is put into input. Why? :(
Thank you so much for any help provided!



Input: from the user Output: standard output Write a program that will calculate both roots of a quadratic equation. The program should ask the user to input a, b, and c and then write both roots to standard output (the screen). Your program should print the roots ordered from least to greatest. If the quadratic equation has a negative discriminant your program should output "NO REAL ROOTS". If the two roots are the same only report one root. Also report the vertex of the parabola. ax2+bx+c=0 x=2abb24ac Note: Round all output to 2 decimal places
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
