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
I have no idea how to use the sep and end in Python can someone help me I have a test tomorrow
Nuetrik [128]

Answer:

The end parameter basically prints after all the output objects present in one output statement have been returned. the sep parameter differentiates between the objects.

Explanation:

Hope this helps

https://www.edureka.co/community/53505/difference-between-end-and-sep#:~:text=end%20and%20sep%20are%20optional,parameter%20differentiates%20between%20the%20objects.

4 0
3 years ago
Write code which takes inputs and creates two Rectangle objects (using the edhesive.shapes.Rectangle class) and compares them us
iogann1982 [59]

Answer:

System.out.println("Enter length:");

Scanner scan = new Scanner(System.in);

Double x = scan.nextDouble();

System.out.println("Enter 2 lengths:");

Double a = scan.nextDouble();

Double b = scan.nextDouble();

Rectangle rect = new Rectangle(x);

Rectangle rect2 = new Rectangle (a,b);

if (rect2.equals(rect)){

 System.out.print("Congruent Rectangles");

}

else {

 System.out.print("Different Rectangles");

}

 }

}

Explanation:

6 0
3 years ago
Where should you look for most objective and unbaised information
jekas [21]
Google, would be the best because of all of the different site, hope this helps!
: )
8 0
3 years ago
Systems management involves allocation of computer resources to keep all processes operating smoothly and at maximum efficiency.
olchik [2.2K]

Answer:operating system (OS), program that manages a computer's resources, especially the allocation of those resources among other programs. Typical resources include the central processing unit (CPU), computer memory, file storage, input/output (I/O) devices, and network connections.

Explanation:

8 0
3 years ago
Best way to get points on here anyone know?
AURORKA [14]

Answer questions, log in daily, and In competition of brainlist answer win

6 0
3 years ago
Read 2 more answers
Other questions:
  • Exp19_Excel_AppCapstone_Intro_Collection
    10·1 answer
  • What will be displayed if code corresponding to the following pseudocode is executed? Set Number = 4 Repeat Write 2 * Number Set
    12·1 answer
  • Write a function named word_count that accepts a string as its parameter and returns the number of words in the string. A word i
    10·1 answer
  • For your biology class, you have taken a number of measurements for a plant growth experiment. You wish to create a chart that s
    15·1 answer
  • What devices gives input​
    5·1 answer
  • Which part of the operating system enables you to interact with the device? Question 9 options: The graphical user interface The
    8·1 answer
  • Recent advances in information technologies (IT) have powered the merger of online and offline retail channels into one single p
    10·1 answer
  • A Variable can only hold numbers<br><br> True<br><br> False
    15·2 answers
  • PLSSS HELP!! During the late 20th century, immigration to the United States increased dramatically from
    7·1 answer
  • How many triangles can you make if the side lengths are 4 cm, 5 cm, and 11 cm?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!