Zdrojové kódy na výuku programování 2. ročník.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
555 B

import math
kvad = int(input("Zadejte kvadratická člen: "))
lin_clen = int(input("Zadejte lineární člen: "))
konst_clen = int(input("Zadejte konstatní člen: "))
disk = (lin_clen*lin_clen)-4*kvad*konst_clen
x1 = 0
x2 = 0
if disk == 0:
x1 = -lin_clen/(2*kvad)
print("x1 = {}".format(x1))
elif disk >0:
x1 = ((-lin_clen)+(math.sqrt(disk)))/2*kvad
x2 ((-lin_clen)-(math.sqrt(disk)))/2*kvad
print("x1 = {}".format(x1))
print("\n x2=".format(x2))
else:
print("Rovnice nemá v realném oboru řešení")