jueves, 10 de septiembre de 2009

PRACTICA 2.0 RESISTENCIAS

CONSOLA







using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace practica_2
{
class Program
{
static void Main(string[] args)
{
int N,M,P,RS;
Console.WriteLine("introduce la cantidad de resistencias de 56 ohms");
N=int.Parse(Console.ReadLine());
Console.WriteLine("Introduce la cantidad de resistencia de 33 ohms");
M = int.Parse(Console.ReadLine());
Console.WriteLine("introduce la cantidad de resistencias de 15 ohms");
P=int.Parse(Console.ReadLine());
RS = N * 56 + M * 33 + P * 15;
Console.WriteLine("la resistencia total en serie es {0}",RS);
Console.ReadKey();
}
}
}

VISUAL



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, M, P, RS;
public Form1()
{
N = M = P = RS = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
N = int.Parse(textBox1.Text);
M = int.Parse(textBox2.Text);
P = int.Parse(textBox3.Text);
RS = N * 56 + M * 33 + P * 15;
textBox4.Text = "la resistencia total en serie es" + RS.ToString();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}
}







No hay comentarios:

Publicar un comentario