Write a Python function to print the root of the quadratic equation


Topic: Write a Python function to print the root of the quadratic equation

Solution

def quadratic_root(A,B,C):
	import math
	d=((B**2)-4*A*C)
	if d>=0:
	    s=(-B+(d)**0.5)/(2*A)
	    p=(-B-(d)**0.5)/(2*A)
	    print(math.floor(s),math.floor(p))
	else:
	    print('The roots are imaginary')



List all Python Programs