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 need to know what is share market plssss
xxTIMURxx [149]
A stock market, equity market or share market is the aggregation of buyers and sellers of stocks, which represent ownership claims on businesses; these may include securities listed on a public stock exchange, as well as stock that is only traded privately
8 0
3 years ago
Read 2 more answers
What is the importance of using Onedrive in Windows 10 and how knowledge of it will have an impact in today's workplace?
SashulF [63]

The importance of one drive in windows 10 is that it helps the user to synchronize files in their computer.

Onedrive is a cloud storage system that is useful for the storage of files in a secured manner. A person can easily access their files whenever they want to.

In todays workplace a knowledge of onedrive has a great impact because

  • Onedrive offers an unlimited access to files whenever they are needed
  • The files can be available and accessed from anywhere
  • It helps with the organization of files in the work place.

One drive allows for this to be done even when offline. When online, there is an automatic synchronization of the made changes.

Read more at brainly.com/question/17163678?referrer=searchResults

7 0
3 years ago
Read 2 more answers
Write a C program to read the values of a 6 x 6 2D array from a file, and then produce an output file that contains the transpos
kvv77 [185]

Answer:

Explanation:

#include <stdio.h>

int main()

{

   int arr[5][5], trans [5][5], i, j;

   // Entering elements to the matrix

   printf("\nEnter matrix elements:\n");

   for (i = 0; i < 6; ++i)

       for (j = 0; j < 6; ++j) {

           printf("Enter element a%d%d: ", i + 1, j + 1);

           scanf("%d", &arr[i][j]);

       }

 

   printf("\nThe given input matrix is: \n");

   for (i = 0; i < 6; ++i)

       for (j = 0; j < 6; ++j) {

           printf("%d  ", arr[i][j]);

           if (j == 5)

               printf("\n");

       }

   // Transpose

   for (i = 0; i < 6; ++i)

       for (j = 0; j < 6; ++j) {

           trans[j][i] = a[i][j];

       }

   printf("\nThe output transpose of the matrix:\n");

   for (i = 0; i < 6; ++i)

       for (j = 0; j < 6; ++j) {

           printf("%d  ", trans[i][j]);

           if (j == 5)

               printf("\n");

       }

   return 0;

}

7 0
3 years ago
The "c" key and the "e" key are struck by
adoni [48]
1 because when you type on the home row your left middle finger will hit both of those letters.
3 0
3 years ago
Read 2 more answers
Which of the following help departments organize unique access controls for access to folders and data files within a department
never [62]

Answer:

B. Role-based access controls

Explanation:

Roll-based access control is a way to control access to the network and to data which depends on the position of employees in a department. This way the permission to access information are granted according to roles that are assigned to employees. This type of access control allows access privileges to employees only to the folders and data files which they need in order to perform their tasks and it does not allow them to access the data or information which is not relevant to them. This helps the department to secure the sensitive information and data files and reduces the risk of data breaches.

6 0
3 years ago
Other questions:
  • Unlike a virtual image, a real image
    7·1 answer
  • Web maintenance plays a vital role in a website's development. It helps ensure the online presence of any website by performing
    8·1 answer
  • Which of these practices should you follow while creating your résumé?
    14·1 answer
  • A group of computers that are interconnected in order to share information or documents is called a _____
    9·1 answer
  • Do you think that people have a “right” to remain anonymous online? Why or why not?
    6·1 answer
  • Write a function that receives three StaticArrays where the elements are already i n sorted order and returns a new Static Array
    11·1 answer
  • When power is completely removed from your computer
    11·1 answer
  • GIVING 50 POINTS!
    6·2 answers
  • What is the purpose of a computer network needs assessment? to evaluate how to move from the current status to the desired goal
    15·1 answer
  • True or False: Cookies placed on a visitor's browser can include enough information to instruct an ad network which types of pro
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!