Hong-Phuc Bui
2024-05-15 7f5f315ce79b213b153684910c20654039a91369
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#! /usr/bin/env python
# -*-  coding: utf-8 -*-
 
import cmath
 
print("Programm zur Lösung einer quadratischer Gleichung ax^2 + bx + c = 0")
= float(input("a = "))
= float(input("b = "))
= float(input("c = "))
 
determinant = b**2 - 4*a*c
= cmath.sqrt(determinant)
x1 = (-- d) / (2*a)
x2 = (-+ d) / (2*a)
print(f"Gleichung: {a}x^2 + {b}x + {c} = 0")
print(f"x1 = {x1}")
print(f"x2 = {x2}")