-
Notifications
You must be signed in to change notification settings - Fork 0
/
pytexe (43).py
46 lines (39 loc) · 917 Bytes
/
pytexe (43).py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# npo.py
def main():
#VARIAVEIS
a=0.0
b=0.0
c=0.0
delta=0.0
x1=0.0
x2=0.0
while True:
a=float(input("Insira o valor de A\n"))
b=float(input("Insira o valor de B\n"))
c=float(input("Insira o valor de C\n"))
delta=float
x1=float
x2=float
delta=(b**2)-(4*a*c)
#PROGRAMA
if (a != 0 and delta >= 0):
x1=(-b+delta**0.5)/2*a
x2=(-b-delta**0.5)/2*a
print("O valor de x' e x'', são respectivamente:", x1,x2)
elif (delta < 0):
print("Solução no domínio dos números complexos")
x1=(-b+delta**0.5)/2*a
x2=(-b-delta**0.5)/2*a
print("O valor de x' e x'', são respectivamente:", x1,x2)
if (a == 0 and b != 0):
x1=c/b
print('O valor de x é:',x1)
elif(b == 0 and c == 0):
print("Qualquer valor de x satisfaz a igualdade")
elif(b == 0 and c != 0):
print("Nenhum valor de x satisfaz a igualdade")
if __name__ == '__main__':
main()