subject

The two roots of a quadratic equation ax^2 + bx + c = 0 can be obtained using the following formula:r1 = (-b + sqrt(b^2 - 4ac)) / (2a)andr2 = (-b - sqrt(b^2 - 4ac)) / (2a)b^2 - 4ac is called the discriminant of the quadratic equation. If it is positive, the equation has two real roots. If it is zero, the equation has one root. If it is negative, the equation has no real roots. Write a program that prompts the user to enter values for a, b, and c and displays the result based on the discriminant. If the discriminant is positive, display two roots. If the discriminant is 0, display one root. Otherwise, display "The equation has no real roots".Note that you can use Math. pow(x, 0.5) to compute sqrt(x).Sample Run 1Enter a, b, c: 1.0 3 1The equation has two roots -0.381966 and -2.61803Sample Run 2Enter a, b, c: 1 2.0 1The equation has one root -1

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:00, opgbadwolf5
What provides an array of buttons for quick access to commonly used commands and tools
Answers: 1
image
Computers and Technology, 24.06.2019 02:30, sha273
Which option completes the explanation for conflict of interest in an organization
Answers: 1
image
Computers and Technology, 24.06.2019 07:30, LuckyCharms988
Consider the folloeing website url: what does the "http: //" represent? a. protocal identifier. b. ftp. c. domain name d. resource name
Answers: 2
image
Computers and Technology, 24.06.2019 11:00, zeesharpe05
These statements describe lists in presentation programs: a. bullets can be turned off and on. b. bullets cannot be turned off. c. bullet styles, colors, and sizes can be changed. d. lists don't have to use bullets or numbers. e. numbering styles, colors, and sizes can be changed. f. numbers can be turned off and on. g. numbers cannot be turned off. select all that apply
Answers: 2
You know the right answer?
The two roots of a quadratic equation ax^2 + bx + c = 0 can be obtained using the following formula:...

Questions in other subjects:

Konu
Mathematics, 10.07.2019 03:00
Konu
Geography, 10.07.2019 03:00