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)

and

r2 = (-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”.

sample run 1

enter a: 1.0

enter b: 3

enter c: 1

the roots are -0.3819660112501051 and -2.618033988749895

sample run 2

enter a: 1

enter b: 2.0

enter c: 1

the root is -1.0

sample run 3

enter a: 1

enter b: 2

enter c: 3

the equation has no real roots

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:40
The most complicated four letter word
Answers: 1
question
Computers and Technology, 22.06.2019 20:50
What is the difference between windows 7 and windows 10?
Answers: 1
question
Computers and Technology, 23.06.2019 10:30
Would a ps4 wired controller work on an xbox one
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
Afiling system in which an intermediary source of reference, such as a file card, must be consulted to locate specific files is called a(n) system. a. shelf filing b. direct filing c. indirect filing d. shingling
Answers: 1
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
question
Chemistry, 16.11.2020 23:10
question
Mathematics, 16.11.2020 23:10
question
Spanish, 16.11.2020 23:10
question
Mathematics, 16.11.2020 23:10
question
Mathematics, 16.11.2020 23:10
Questions on the website: 13722363