using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int n;
double prom = 0.0;
int total = 0;
int suma = 0;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (n != 9999)
{
n = int.Parse(textBox1.Text);
listBox1.Items.Add("VALOR NUMERICO " + n.ToString());
suma = suma + n;
total = total + 1;
textBox1.Clear();
}
else
{
prom = suma / total;
listBox1.Items.Add("EL PROMEDIO ES : " + prom.ToString());
textBox1.Enabled = false;
button1.Enabled = false;
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
listBox1.Items.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
No hay comentarios:
Publicar un comentario