In this we are going to see a program to find Roots of Quadratic Equations in Python Programming Language.
from math import sqrt
# Values Of a,b,c
a = int(input("Enter The a Value : "))
b = int(input("Enter The b Value : "))
c = int(input("Enter The c Value : "))
# Calculate Discriminant
r = (b**2)-(4*a*c)
print("The Value Of Discriminant : ",r)
print("Number Of Roots = 2")
x1 = (((-b)+sqrt(r))/(2*a))
x2 = (((-b)-sqrt(r))/(2*a))
print(f'The Two Roots Are x1 = {x1} And x2 = {x2}')
# Coded By DHIRAJ SHELKE
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP