lunes, 22 de febrero de 2010

Practica5_4

namespace Practica5_problema4V
{
public partial class Form1 : Form
{
string nombre;
double C1,C2,C3,C4,C5,PROM;
public Form1()
{
InitializeComponent();
nombre = "";
C1 = C2 = C3 = C4 = C5 = 0.0;
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
nombre = textBox1.Text;
C1 = double.Parse(textBox2.Text);
C2 = double.Parse(textBox3.Text);
C3 = double.Parse(textBox4.Text);
C4 = double.Parse(textBox5.Text);
C5 = double.Parse(textBox6.Text);
PROM = (C1 + C2 + C3 + C4 + C5) / 5;
label8.Text="El promedio" + " es:" + PROM;

if (PROM < 70)
{
label7.Text = "REPROBASTE BABOSO";
}
else
{
label7.Text = "MUY BIEN APROBASTE";
}

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Focus();
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox6.Clear();
label7.Text = "";
label8.Text = "";
}

private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}

namespace Practica5_problema4C
{
class Program
{
static void Main(string[] args)
{
string nombre;
double C1, C2, C3, C4, C5, PROM;
Console.WriteLine("Introduce tu nombre:");
nombre = Console.ReadLine();
Console.WriteLine("Introduce C1,C2,C3,C4,C5:");
C1 = double.Parse(Console.ReadLine());
C2 = double.Parse(Console.ReadLine());
C3 = double.Parse(Console.ReadLine());
C4 = double.Parse(Console.ReadLine());
C5 = double.Parse(Console.ReadLine());

PROM = (C1 + C2 + C3 + C4 + C5) / 5;
Console.WriteLine("El promedio final de " + nombre + " es:" + PROM);

if (PROM < 70)
{
Console.WriteLine("REPROBADO BABOSO");
}
else
{
Console.WriteLine("MUY BIEN APROBASTE");
}
{
Console.ReadLine();
}
{
Console.ReadKey();
}
}
}
}



No hay comentarios:

Publicar un comentario