LightProgrammer000

Tabuada_operacoes

Jun 16th, 2023 (edited)
1,326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. i = 1
  2.  
  3. while True:
  4.  
  5.     print(f"\n{'=-=' * 5} Menu {'=-=' * 5}")
  6.     print(f"[1] Adicao ")
  7.     print(f"[2] Subtracao")
  8.     print(f"[3] Divisao")
  9.     print(f"[4] Multiplicacao")
  10.     print(f"[0] Exit")
  11.     resp = int(input("Opc.: "))
  12.  
  13.     if resp == 0:
  14.         break
  15.  
  16.     elif 0 < resp < 5:
  17.  
  18.         # Entrada de dados
  19.         n = float(input(f"\n# Tabuada de qual numero: "))
  20.         print(f"{'=-=' * 10}")
  21.  
  22.         # Estrutura de repeticao
  23.         while i < 11:
  24.  
  25.             if resp == 1:
  26.                 print(f"# {n} + {i} = {n + i:.2f}")
  27.  
  28.             elif resp == 2:
  29.                 print(f"# {n} - {i} = {n - i:.2f}")
  30.  
  31.             elif resp == 3:
  32.                 print(f"# {n} / {i} = {n / i:.2f}")
  33.  
  34.             elif resp == 4:
  35.                 print(f"# {n} x {i} = {n * i}")
  36.  
  37.             # Incremento
  38.             i += 1
  39.  
  40.         print(f"{'=-=' * 10}")
  41.         i = 1
  42.  
Advertisement
Add Comment
Please, Sign In to add comment