Advertisement
lucast0rres

Lista 2 - Item P

Apr 14th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #This algorithm was crated by Lucas Pereira Torres de Araujo
  2. #Lista 2 - FUP's Class - 2016.1
  3. #Item P
  4.  
  5. ALGORITMO
  6. DECLARE
  7. a, b, c, d1, d2, d3, d4, d5, d6 NUMERICO
  8. hip, cateto1, cateto2 NUMERICO
  9. x1, relacao1, graus1, x2, relacao2, graus2 NUMERICO
  10.  
  11. ESCREVA "Digite os três lados do triângulo: "
  12. LEIA a, b, c
  13.  
  14. d1 ← |(b - c)|
  15. d2 ← |(a - c)|
  16. d3 ← |(a - b)|
  17. d4 ← (b + c)
  18. d5 ← (a + c)
  19. d6 ← (a + b)
  20.  
  21. #1.1 - Verificar a existência do triangulo
  22. SE d1 < a E a < d4 E d2 < b E b < d5 E d3 < c E c < d6 ENTÃO
  23. ESCREVA "Existe um triângulo cujo os lados são:", a, b, c
  24.  
  25. #1.2 - Verificar a hipotenusa e os catetos, se é retângulo
  26. SE a > b E a > c ENTÃO
  27. hip ← a
  28. cateto1 ← b
  29. cateto2 ← c
  30. SENÃO
  31. SE b > a E b > c ENTÃO
  32. hip ← b
  33. cateto1 ← a
  34. cateto2 ← c
  35. SENÃO
  36. SE c > a E c > b ENTÃO
  37. hip ← c
  38. cateto1 ← a
  39. cateto2 ← b
  40. #1.2 - FIM
  41.  
  42. #1.3 - Verificar se obedece ao teorema de Pitágoras, se é retângulo.
  43. SE hip² = (cateto1² + cateto2²) ENTÃO
  44. ESCREVA "É um triângulo retângulo."
  45.  
  46. #Arco seno é o inverso do Seno
  47. relacao1 ← cateto1/hip
  48. x1 ← Arcoseno(relacao1)
  49. graus1 ← (x*180)/PI
  50.  
  51. relacao2 ← cateto2/hip
  52. x2 ← Arcoseno(relacao2)
  53. graus2 ← (x*180)/PI
  54.  
  55. ESCREVA "Os ângulos são: 90°,", graus1, graus2
  56.  
  57. SENÃO
  58. ESCREVA "Não é um triângulo retângulo."
  59. #1.3 - FIM
  60.  
  61. SENÃO
  62. ESCREVA "Não existe um triângulo cujos lados sejam:", a, b, c
  63. #1.1 - FIM
  64.  
  65. FIM_ALGORITMO.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement