Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This algorithm was crated by Lucas Pereira Torres de Araujo
- #Lista 2 - FUP's Class - 2016.1
- #Item P
- from math import asin, pi
- a = float(input("Digite o valor do lado A: "))
- b = float(input("Digite o valor do lado B: "))
- c = float(input("Digite o valor do lado C: "))
- d1 = abs(b - c)
- d2 = abs(a - c)
- d3 = abs(a - b)
- d4 = (b + c)
- d5 = (a + c)
- d6 = (a + b)
- if d1 < a and a < d4 and d2 < b and b < d5 and d3 < c and c < d6 :
- print "Existe um triangulo cujos lados sao:", a, b, c
- global d8, d7, hip, cateto1, cateto2
- if a >= b and a >= c :
- hip = a
- cateto1 = b
- cateto2 = c
- d7 = ((cateto1*cateto1) + (cateto2*cateto2))
- d8 = (hip*hip)
- elif b >= a and b >= c :
- hip = b
- cateto1 = a
- cateto2 = c
- d7 = ((cateto1*cateto1) + (cateto2*cateto2))
- d8 = (hip*hip)
- elif c >= a and c >= b :
- hip = c
- cateto1 = a
- cateto2 = b
- d7 = ((cateto1*cateto1) + (cateto2*cateto2))
- d8 = (hip*hip)
- if d8 == d7 :
- print "E um triangulo retangulo = 90 graus."
- relacao1 = float(cateto1/hip)
- x1 = float(asin(relacao1))
- graus1 = float((x1*180)/pi)
- relacao2 = float(cateto2/hip)
- x2 = float(asin(relacao2))
- graus2 = float((x2*180)/pi)
- print "Os angulos (em graus) sao: 90,", graus1, graus2
- else :
- print "Nao e um triangulo retangulo."
- else :
- print "Nao existe um triangulo cujos lados sejam:", a, b, c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement