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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:30, marialuizavalen
Today is the anniversary of me being on yet, i don't need it anymore! here's a picture of my dog wearing a bowtie! my question is, how do i delete my account?
Answers: 1
image
Computers and Technology, 22.06.2019 18:00, alexj29227405
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
image
Computers and Technology, 22.06.2019 20:00, ksanchez2100
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
image
Computers and Technology, 23.06.2019 21:40, minnie7760
Draw the resistor’s voltage and current phasors at t=15ms. draw the vectors with their tails at the origin. the orientation of your vectors will be graded. the exact length of your vectors will not be graded.
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
Health, 14.06.2020 15:57
Konu
Business, 14.06.2020 15:57
Konu
Mathematics, 14.06.2020 15:57
Konu
Mathematics, 14.06.2020 15:57