Professional Documents
Culture Documents
DE INFORMTICA DE
GESTO
Cdigo (C#)
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
System.Windows.Forms;
namespace Exer_Revisao_01
{
public partial class Form1 : Form
{
double n1, n2, n3, media, max, min;
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
//Boto Fechar
Pgina 1 de 4
DE INFORMTICA DE
GESTO
Pgina 2 de 4
DE INFORMTICA DE
GESTO
label7.Text = media.ToString();
//Calcular Mximo
if (n1 > n2)
if (n1 > n3)
max = n1;
else
max = n3;
else
if (n2 > n3)
max = n2;
else
max = n3;
label8.Text = max.ToString();
//Calcular Mnimo
if (n1 < n2)
if (n1 < n3)
min = n1;
else
min = n3;
else
if (n2 < n3)
min = n2;
else
min = n3;
label9.Text = min.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
//Limpar campos
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
label7.Text = "";
label8.Text = "";
label9.Text = "";
}
// Validar introducao de numeros entre 0 e 20
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text != "")
if ((double.Parse(textBox1.Text) < 0) || (double.Parse(textBox1.Text) > 20))
{
MessageBox.Show("O numero deve estar entre 0 e 20 valores");
textBox1.Text = "";
textBox1.Focus();
}
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
if (textBox2.Text != "")
Pgina 3 de 4
DE INFORMTICA DE
GESTO
Pgina 4 de 4