1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
laila [671]
3 years ago
14

The two roots of a quadratic equation, for example 2 + + = 0, can be obtained using the following formula: Two Roots: 1 = − + √

2−4 2 and 2 = − − √ 2−4 2 2 − 4 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. One Root: 1 = − 2 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.
Here are some sample runs:
Enter a, b, c: 1.0, 3, 1
The roots are -0.381966 and -2.61803
Enter a, b, c: 1, 2.0, 1
The root is -1.0
Enter a, b, c: 1, 2, 3
The equation has no real roots
Computers and Technology
1 answer:
Vladimir79 [104]3 years ago
5 0

lst = input("Enter a,b,c: ").split(",")

a = float(lst[0])

b = float(lst[1])

c = float(lst[2])

root1 = (-b + ((b**2-(4*a*c))**0.5))/(2*a)

root2 = (-b - ((b**2-(4*a*c))**0.5))/(2*a)

dis = b**2 - (4*a*c)

if dis > 0:

   print("The roots are {} and {}".format(root1, root2))

elif dis < 0:

   print("The equation has no real roots")

else:

   print("The root is {}".format(root1))

I wrote my code in python 3.8. I hope this helps!

You might be interested in
The computer uses unallocated space for what​
finlep [7]

A computer uses unallocated space also know as free space to keep a file that has been deleted in its disk until a new file takes it spot and overwrites it.

3 0
4 years ago
Read 2 more answers
What do we call exceptions to the exclusive rights of copyright law?
Studentka2010 [4]

Answer:

Fair use

Explanation:

I don't know if this is correct but Its the best option.

4 0
3 years ago
Where does the report footer section appear?
natka813 [3]

The report footer section appears at the bottom of the last page. The correct option is b.

<h3>What is a report footer section?</h3>

The report footer is that contain the report items. It is placed in the last page or the bottom of the report border. It is present only one time exactly at the last page.

Thus, the correct option is b, at the bottom of the last page.

Learn more about report footer section

brainly.com/question/13261774

#SPJ1

3 0
2 years ago
This is really dumb but can someone help me find these memes? I can’t remember what they’re called but I remember how they went
grin007 [14]
Omg I remember those hi at look on google
4 0
3 years ago
Read 2 more answers
The template for organizing SRS given by American Department ofDefense and NASA should be used for
Grace [21]

Answer: C) Medium size projects

Explanation:

 The template for organize SRS is given by the American Department of Defense and NASA should be used for medium size projects. As, SRS is the key component of the marshall center and NASA provides its space surveillance requirement to the U.S. Basically, NASA is stands for the national aeronautics and space administration and it is a independent agency for united states.

5 0
3 years ago
Other questions:
  • In the C-SCAN disk scheduling algorithm, the disk arm is required to move in one direction only until it reaches the last track
    7·1 answer
  • A Uniform Resource Locator (URL) consists of three separate parts: network protocol, host, and web browser.
    11·2 answers
  • William found out that someone used his report on American culture without his permission. What is William a victim of?
    8·2 answers
  • Consider the following skeletal C program: void fun1(void); /* prototype */ void fun2(void); /* prototype */ void fun3(void); /*
    11·1 answer
  • Create a program in Python that prompts the user to enter an integer number within the range of 1 to 10 inclusive. The program s
    15·2 answers
  • is there anybody out there who is a social butterfly like me? If so then you can tlk to me on this. and to anybody out there tha
    12·1 answer
  • Mr. Stevens is the principal of a high school. Why might he want to export data from a database of students’ exam scores?
    14·2 answers
  • Here is the problem specification: An Internet service provider has three different subscription packages for its customers: Pac
    5·1 answer
  • Help plz. due yesterday
    13·1 answer
  • Smart art can be used to create that highlight relationships between two items
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!