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 15:00
Hyperactive media sales has 10 windows 7 laptop computers used by sales-people in the organization. each laptop computer has several customized applications that are used during the sales process as well as customer relationship management software. all of the applications on the laptops are difficult to configure and have large data files. if all of the laptops have current hardware, what is the easiest way to install windows 10 on them?
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
The initial tableau of a linear programming problem is given. use the simplex method to solve it. x 1 x 2 x 3 s 1 s 2 z 1 2 4 1 0 0 8 3 4 1 0 1 0 10 minus3 minus12 1 0 0 1 0 the maximum is nothing when x 1equals nothing, x 2equals nothing, x 3equals nothing, s 1equals3, and s 2equals0. (be sure to simplify to lowest terms if necessary.)
Answers: 2
question
Computers and Technology, 24.06.2019 03:30
Auniform resource locator (url) is a formatted string of text that web browsers, email applications, and other software programs use to identify a particular resource on the internet. true false
Answers: 2
question
Computers and Technology, 24.06.2019 22:30
When can you access the bios setup utility?
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
Arts, 12.12.2020 16:30
question
Mathematics, 12.12.2020 16:30
question
Mathematics, 12.12.2020 16:30
question
Business, 12.12.2020 16:30
question
Mathematics, 12.12.2020 16:30