test
This commit is contained in:
17
task_6.py
Normal file
17
task_6.py
Normal file
@@ -0,0 +1,17 @@
|
||||
a = float(input("Введите a: "))
|
||||
b = float(input("Введите b: "))
|
||||
c = float(input("Введите c: "))
|
||||
|
||||
D = b * b - 4 * a * c
|
||||
|
||||
if D < 0:
|
||||
print("Уравнение не имеет действительных корней")
|
||||
else:
|
||||
if D == 0:
|
||||
x = -b / (2 * a)
|
||||
print(f"x = {x:.1f}")
|
||||
else:
|
||||
x1 = (-b + D ** 0.5) / (2 * a)
|
||||
x2 = (-b - D ** 0.5) / (2 * a)
|
||||
print(f"x1 = {x1:.1f}")
|
||||
print(f"x2 = {x2:.1f}")
|
||||
Reference in New Issue
Block a user