We can also change the value of a, b and c to check with various equations.Ĭomment for any suggestions, concerns or to discuss more about the quadratic equation. First we calculate the discriminant and then find the two solutions of the quadratic equation. We have imported the cmath module to perform complex square root. Later we will find solution of Quadratic Equation. Next, we would prompt user to input the value. The important condition for an equation to be a quadratic equation is the coefficient of x 2 is a non-zero term (a 0). The quadratic equation in its standard form is ax 2 + bx + c 0, where a and b are the coefficients, x is the variable, and c is the constant term. The solutions are (-3+0j) and (-2+0j) Explanation: In this program we will create a program which will solve a Quadratic Equation.First we would declared and initialized the required variables. A quadratic equation is an algebraic equation of the second degree in x. Print('The solution are '.format(sol1,sol2)) OUTPUT: Enter a: 1 # To take coefficient input from the users Program to Solve Quadratic Equation in Python: # Solve the quadratic equation ax**2 + bx + c = 0 See examples of finding real, complex, or different roots of a quadratic equation with code and output.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |