Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """
- Hacer un programa que pida tres valores y determine si pueden formar
- un triángulo rectángulo
- teo de pitagoras H**2 = a**2 + b**2
- ej: 3,4,5 5**2 = 3**2 + 4**2
- """
- a = int(input("Ingrese un valor a: "))
- b = int(input("Ingrese un valor b: "))
- c = int(input("Ingrese un valor c: "))
- if a**2 == b**2 + c**2:
- print(f"Rectangulo con hipotenusa {a}")
- elif b**2 == a**2 + c**2:
- print(f"Rectangulo con hipotenusa {b}")
- elif c**2 == a**2 + b**2:
- print(f"Rectangulo con hipotenusa {c}")
- else:
- print(f"{a},{b} y {c} no forman un triángulo rectángulo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement