Skip to content

Commit e93eeb3

Browse files
committed
Add ejercicio4
1 parent e08748d commit e93eeb3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

07-ejercicios/ejercicio4.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Ejercicio 4.
3+
Pedir dos numeros al usuario y hacer todas las operaciones básicas de una calculadora
4+
"""
5+
6+
import math
7+
8+
9+
numero1 = float(input("Ingrese el primer número: "))
10+
numero2 = float(input("Ingrese el segundo número: "))
11+
12+
suma = numero1 + numero2
13+
resta = numero1 - numero2
14+
multiplicacion = numero1 * numero2
15+
division = numero1 / numero2 if numero2 != 0 else "Error: División por cero no permitida"
16+
redondeo = math.ceil(numero1)
17+
print(f"Resultados:")
18+
print(f"Suma: {suma}")
19+
print(f"Resta: {resta}")
20+
print(f"Multiplicación: {multiplicacion}")
21+
print(f"División: {division}")
22+
print(f"Redondeo: {redondeo}")
23+
print("---END CALCULADORA---")

0 commit comments

Comments
 (0)