1. Write a program to input co-efficients of a, b and c of a quadratic equation ax2 + bx + c = 0, where a = 0. Discriminant, D = b2- 4ac.If discriminant is 0 then print there is exactly one real root, if discriminant is positive then print there are two distinct roots, if discriminant is negative then print then there are no real roots.
a = float(input('Please input a:'))
b = float(input('Please input b:'))
c = float(input('Please input c:'))
d = b * b - 4 * a * c
if d > 0:
print('there are two distinct roots')
elif d == 0:
print('there is exactly one real root')
else:
print('there are no real roots')
Comments
Leave a comment