Escreva um programa que mostre a tabela de multiplicação de um número.
Saída esperada:
Entrada: 5 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 = 25 5 x 6 = 30 5 x 7 = 35 5 x 8 = 40 5 x 9 = 45 5 x 10 = 50
Solução C#:
mostrar solução
public class Exerc { public static void Main() { int x; int result; Console.WriteLine("Entrada:> "); x = Convert.ToInt32(Console.ReadLine() ); result = x * 1; Console.WriteLine("Tabela de Multiplicação:> {0} x {1} = {2}", x, 1, result); result = x * 2; Console.WriteLine(" : {0} x {1} = {2}", x, 2, result); result = x * 3; Console.WriteLine(" : {0} x {1} = {2}", x, 3, result); result = x * 4; Console.WriteLine(" : {0} x {1} = {2}", x, 4, result); result = x * 5; Console.WriteLine(" : {0} x {1} = {2}", x, 5, result); result = x * 6; Console.WriteLine(" : {0} x {1} = {2}", x, 6, result); result = x * 7; Console.WriteLine(" : {0} x {1} = {2}", x, 7, result); result = x * 8; Console.WriteLine(" : {0} x {1} = {2}", x, 8, result); result = x * 9; Console.WriteLine(" : {0} x {1} = {2}", x, 9, result); result = x * 10; Console.WriteLine(" : {0} x {1} = {2}", x, 10, result); } }
esconder solução
The following two tabs change content below.
Arquiteto de Software e Desenvolvedor Backend (quase Fullstack), geralmente trabalho com C#, PowerShell, Python, Golang, bash e Unity (esse é mais por hobby). Estou sempre buscando algo novo para aprender, adicionando novas ferramentas ao meu cinto de utilidades.
Latest posts by Breno RdV (see all)
- O que é Metaclass e como ela funciona. (#python #dev #metaclass) - janeiro 11, 2023
- Entenda a mágica dos Generators. (#python, #dev, #generator, #iterator) - dezembro 28, 2022
- Ordenando um DataFrame por múltiplas colunas. (#python #pandas #jupyter #dev #data) - agosto 3, 2022