Advertisement
teslariu

rect

Apr 24th, 2021
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. Hacer un programa que pida tres valores y determine si pueden formar
  6. un triángulo rectángulo
  7.  
  8. teo de pitagoras H**2 = a**2 + b**2
  9.  
  10. ej: 3,4,5   5**2 = 3**2 + 4**2
  11. """
  12. a = int(input("Ingrese un valor a: "))
  13. b = int(input("Ingrese un valor b: "))
  14. c = int(input("Ingrese un valor c: "))
  15.  
  16. if a**2 == b**2 + c**2:
  17.     print(f"Rectangulo con hipotenusa {a}")
  18.    
  19. elif b**2 == a**2 + c**2:
  20.     print(f"Rectangulo con hipotenusa {b}")
  21.    
  22. elif c**2 == a**2 + b**2:
  23.     print(f"Rectangulo con hipotenusa {c}")
  24.    
  25. else:
  26.     print(f"{a},{b} y {c} no forman un triángulo rectángulo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement