1 changed files with 20 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
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í") |
||||
Loading…
Reference in new issue