Advertisement
Guest User

Código para calculadora simples em C#

a guest
Jun 15th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. //Código para calculadora simples em C#.
  2.  
  3. private void btnCalcular_Click(object sender, EventArgs e)
  4.         {
  5.             txtTabuada.Text = "";
  6.             if (txtTabuadaDesejada.Text == "")
  7.             {
  8.                 MessageBox.Show("Você precisa digitar um número para calcular a tabuada.", "Informação",
  9.                     MessageBoxButtons.OK, MessageBoxIcon.Information);
  10.             }
  11.             else
  12.             {
  13.                 double numero, resultado;
  14.                 numero = double.Parse(txtTabuadaDesejada.Text);
  15.  
  16.                 for (int i = 0; i <= 10; i++)
  17.                 {
  18.                     resultado = numero * i;
  19.                     txtTabuada.Text += numero + "x" + i + "=" + resultado + "\r\n";
  20.                 }
  21.             }
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement