miércoles, 24 de marzo de 2010

practica 7

Practica 7_1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string nombre;
char sexo;
int edad;
float estatura;
float peso;
int color_ojos;
int color_cabello;
int Num_F = 0;
int Num_M = 0;
int continuar = 1;
while (continuar == 1)
{
Console.WriteLine("Nombre estudiante : ");
nombre = Console.ReadLine();
Console.WriteLine("Sexo(F=Femenino M= Masculino)");
sexo = char.Parse(Console.ReadLine());
Console.WriteLine("Edad");
edad = int.Parse(Console.ReadLine());
Console.WriteLine("Estatura");
estatura = float.Parse(Console.ReadLine());
Console.WriteLine("Peso (en kilos)");
peso = float.Parse(Console.ReadLine());
Console.WriteLine("Color de ojos(1 azul, 2 castaño, 3otro )");
color_ojos = int.Parse(Console.ReadLine());
Console.WriteLine("color de cabellos (1 castaño, 2 rubio, 3 otro)");
color_cabello =int.Parse(Console.ReadLine());
if (sexo =='f' && estatura >= 1.65 && estatura <= 1.75 && peso < num_f =" Num_F" sexo ="=">= 1.70 && peso>=60 &&peso<=70) { Num_M = Num_M + 1; } Console.WriteLine("Desea registriar otro alumno ( 0=n 1 =si)"); continuar = int.Parse(Console.ReadLine()); } Console.WriteLine("Numero de Alumnos sexo femenino color ojos azul estatura >=1.65 y <=1.75, peso<55">1.70 peso entre 60 y 70Kg" + Num_M);
Console.ReadKey();






}
}
}

Practica 7_1 pseudocodigo

Declarar variables
string nombre;
char sexo;
int edad;
float estatura;
float peso;
int color_ojos;
int color_cabello;
int Num_F = 0;
int Num_M = 0;
int continuar = 1;
while (continuar == 1)
{
Print"Nombre estudiante : ";
Read nombre
Print "Sexo(F=Femenino M= Masculino)";
Read sexo
Print"Edad";
Read edad
Print"Estatura";
estatura = float.Parse(Console.ReadLine());
Print"Peso (en kilos)";
read peso;
Print"Color de ojos(1 azul, 2 castaño, 3otro )";
Read color_ojos;
Print "color de cabellos (1 castaño, 2 rubio, 3 otro)";
Read color_cabello ;
if (sexo =='f' && estatura >= 1.65 && estatura <= 1.75 && peso < num_f =" Num_F" sexo ="=">= 1.70 && peso>=60 &&peso<=70) { Num_M = Num_M + 1; } Print"Desea registriar otro alumno ( 0=n 1 =si)"; Read continuar; = } Print"Numero de Alumnos sexo femenino color ojos azul estatura >=1.65 y <=1.75, peso<55">1.70 peso entre 60 y 70Kg" + Num_M);

Practica 7_1 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 practica_7_1
{


public partial class Form1 : Form
{
string nombre;
char sexo;
int edad;
float Estatura, Peso;
int color_ojos, color_cabello;
int num_F,num_M;
public Form1()
{
InitializeComponent();
nombre = " ";
edad = 0;
Estatura = Peso = 0.0f;
color_ojos = color_cabello =num_F=num_M=0;
}

private void button1_Click(object sender, EventArgs e)
{
nombre = textBox1.Text;
if (checkBox1.Checked)
{
sexo = 'F';
}

if (checkBox2.Checked)
{
sexo = 'M';
}
edad = int.Parse(textBox2.Text);
Estatura = float.Parse(textBox3.Text);
Peso = float.Parse(textBox4.Text);
if (checkBox3.Checked)
{
color_ojos=1;
}
if (checkBox4.Checked)
{
color_ojos = 2;
}
if (checkBox5.Checked)
{
color_ojos = 3;
}
if (checkBox6.Checked)
{
color_cabello = 1;
}
if (checkBox7.Checked)
{
color_cabello = 2;
}
if (checkBox8.Checked)
{
color_cabello = 3;
}
if (sexo == 'F' && color_cabello ==2&& color_ojos==1 && Estatura >= 1.65f && Estatura <= 1.75f && Peso < 55)
{
num_F++;
}
if (sexo =='M'&& color_ojos == 2 && Estatura >1.70f && Peso >= 60&& Peso <= 70)
{
num_M++;
}

listBox1.Items.Add("No. de mujeres " + num_F);
listBox1.Items.Add("No de Hombres " + num_M);






}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = " ";
textBox2.Text = " ";
textBox3.Text = " ";
textBox4.Text = " ";
checkBox1.Checked = false;
checkBox2.Checked = false;
checkBox3.Checked = false;
checkBox4.Checked = false;
checkBox5.Checked = false;
checkBox6.Checked = false;
checkBox7.Checked = false;
checkBox8.Checked = false;
listBox1.Items.Clear();




Practica 7_2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int opcion;
double bm=0;
double camisa = 0;
double tenis = 0;
double toallaM = 0;
double pantalon = 0;
double valor= 0;
int continuar = 1;
Console.WriteLine("Numero de producto\tDescripcion\tPrecio de lista");
Console.WriteLine("\n1\t\t\tBolsa de mano\t$28.50\n2\t\t\tCamisa\t\t$45.0\n3\t\t\tTenis\t\t$99.0\n4\t\t\tToalla M\t$49.99\n5\t\t\tPantalon\t$68.50");

do
{
Console.WriteLine("selecciones opcion");
opcion = int.Parse(Console.ReadLine());

switch (opcion)
{
case 1:
Console.Write("cantidad de bolsas de mano: ");
bm = int.Parse(Console.ReadLine());
valor=valor+bm*28.50;


break;
case 2:
Console.Write("cantidad camisas: ");
camisa=int.Parse(Console.ReadLine());
valor=valor+camisa*45.0;
break;
case 3:
Console.Write("cantidad Tenis: ");
tenis=int.Parse(Console.ReadLine());
valor=valor+tenis*99.0;
break;
case 4:
Console.Write("cantidad ToallasM: ");
toallaM=int.Parse(Console.ReadLine());
valor=valor+toallaM*49.99;
break;
case 5:
Console.Write("cantidad Pantalones: ");
pantalon=int.Parse(Console.ReadLine());
valor=valor+pantalon*45.0;
break;
}
Console.WriteLine("desea agregar otro producto 1=si , 0= calculo de factura ");
continuar=int.Parse(Console.ReadLine());

}

while (continuar == 1);
Console.WriteLine("cantidad Producto subtotal");
if (bm > 0)
{
Console.WriteLine("{0}\t\bolsa de mano\t\t{1}", bm, bm * 28.50);
}
if (camisa > 0)
{
Console.WriteLine("{0}\tcamisa\t\t{1}",camisa, camisa * 45.0);
}
if (tenis > 0)
{
Console.WriteLine("{0}\ttenis\t\t{1}", tenis, tenis * 99.0);
}
if (toallaM > 0)
{
Console.WriteLine("{0}\ttoalla M\t\t{1}", toallaM, toallaM * 49.99);
}
if (pantalon > 0)
{
Console.WriteLine("{0}\tpantalon\t\t{1}", pantalon, pantalon * 68.50);
}
Console.WriteLine("\t\t\t\tSubtotal={0}", valor);
Console.WriteLine("\t\t\t\tIva(11%)={0}", valor * .11);
Console.WriteLine("\t\t\t\ttotal={0}", valor * 1.11);
Console.ReadKey();

}
}

Practica 7_2 Pseudocodigo
Declarar variables
int opcion;
double bm=0;
double camisa = 0;
double tenis = 0;
double toallaM = 0;
double pantalon = 0;
double valor= 0;
int continuar = 1;
Print"Numero de producto Descripcion Precio de lista";
Print "1 Bolsa de mano t$28.50\n2\t\t\tCamisa\t\t$45.0\n3\t\t\tTenis\t\t$99.0\n4\t\t\tToalla M\t$49.99\n5\t\t\tPantalon\t$68.50";

do
{
Print"selecciones opcion";
Read opcion

switch (opcion)
{
case 1:
Print"cantidad de bolsas de mano: ";
Read bm ;
valor=valor+bm*28.50;


break;
case 2:
Print"cantidad camisas: ";
Read camisa;
valor=valor+camisa*45.0;
break;
case 3:
Print"cantidad Tenis: ";
Read tenis;
valor=valor+tenis*99.0;
break;
case 4:
Print"cantidad ToallasM: ";
Read toallaM;
valor=valor+toallaM*49.99;
break;
case 5:
Print"cantidad Pantalones: ");
pantalon=int.Parse(Console.ReadLine());
valor=valor+pantalon*45.0;
break;
}
Print"desea agregar otro producto 1=si , 0= calculo de factura ";
Read continuar

}

while (continuar == 1);
Print"cantidad Producto subtotal";
if (bm > 0)
{
Print("{0}\t\bolsa de mano\t\t{1}", bm, bm * 28.50);
}
if (camisa > 0)
{
Print("{0}\tcamisa\t\t{1}",camisa, camisa * 45.0);
}
if (tenis > 0)
{
Print("{0}\ttenis\t\t{1}", tenis, tenis * 99.0);
}
if (toallaM > 0)
{
Print("{0}\ttoalla M\t\t{1}", toallaM, toallaM * 49.99);
}
if (pantalon > 0)
{
Print("{0}\tpantalon\t\t{1}", pantalon, pantalon * 68.50);
}
Print("\t\t\t\tSubtotal={0}", valor);
("\t\t\t\tIva(11%)={0}", valor * .11);
Print("\t\t\t\ttotal={0}", valor * 1.11);
Practica 7_2visual
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
{
bolsa bm;
camisa cm;
pantalon pt;
tenis tn;
toalla tm;
public Form1()
{
InitializeComponent();
bm = new bolsa();
cm = new camisa();
pt = new pantalon();
tn = new tenis();
tm = new toalla();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
bm.Show();
}

private void button2_Click(object sender, EventArgs e)
{
cm.Show();
}

private void button3_Click(object sender, EventArgs e)
{
tn.Show();
}

private void button4_Click(object sender, EventArgs e)
{
tm.Show();
}

private void button5_Click(object sender, EventArgs e)
{
pt.Show();
}

private void button6_Click(object sender, EventArgs e)
{
if (bm.b > 0)
{
listBox1.Items.Add("bolsa de mano " + bm.total);

}
if (cm.b> 0)
{
listBox1.Items.Add("camisa " + cm.total);
}
if (tn.b > 0)
{
listBox1.Items.Add("tenis " + tn.total);
}
if (tm.b > 0)
{
listBox1.Items.Add("toalla " + cm.total);
}

}
}
}
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 bolsa : Form
{
public double total, b;
public bolsa()
{
InitializeComponent();
b = total = 0;
}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 28.50);
label2.Text = "total" +total;
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 camisa : Form
{
public double total, b;
public camisa()
{
InitializeComponent();
b = total = 0;
}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 45.00);
label2.Text = "total" + total;
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 camisa : Form
{
public double total, b;
public camisa()
{
InitializeComponent();
b = total = 0;
}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 45.00);
label2.Text = "total" + total;
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}

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
{
bolsa bm;
camisa cm;
pantalon pt;
tenis tn;
toalla tm;
public Form1()
{
InitializeComponent();
bm = new bolsa();
cm = new camisa();
pt = new pantalon();
tn = new tenis();
tm = new toalla();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
bm.Show();
}

private void button2_Click(object sender, EventArgs e)
{
cm.Show();
}

private void button3_Click(object sender, EventArgs e)
{
tn.Show();
}

private void button4_Click(object sender, EventArgs e)
{
tm.Show();
}

private void button5_Click(object sender, EventArgs e)
{
pt.Show();
}

private void button6_Click(object sender, EventArgs e)
{
if (bm.b > 0)
{
listBox1.Items.Add("bolsa de mano " + bm.total);

}
if (cm.b> 0)
{
listBox1.Items.Add("camisa " + cm.total);
}
if (tn.b > 0)
{
listBox1.Items.Add("tenis " + tn.total);
}
if (tm.b > 0)
{
listBox1.Items.Add("toalla " + cm.total);
}

}
}
}


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 pantalon : Form
{

public double total, b;
public pantalon()
{
InitializeComponent();
b = total = 0;
}

private void label1_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 68.50);
label2.Text = "total" + total;
}
}
}

sing 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 tenis : Form
{
public double total, b;
public tenis()
{
InitializeComponent();
b = total = 0;
}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 99.00);
label2.Text = "total" + total;
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}






Practica 7_3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace practica_7_problema_3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Serie = 1 + 1.0/2.0 + 1.0/4.0 + 1.0/6.0 + 1.0");
double serie = 1;
int contador = 1;
double denominador = 0.0;
Console.Write("serie= 1+/t");
while (contador < denominador =" denominador" serie =" serie" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdWaA0Qkk84XiUvLuX-RQdCxOi0gUgE51AM9HOscY8zx3zR022IOxuf2nQlPPpCEcLDdZ2b_3FkpJ-XoqC1LqNsiWETAgB_rVNOn6zNf1Rq2NqLLmg-qq7bo_zP-q3enL2LNnWJt87kBII/s1600/7_3c.bmp">
Practica 7_3visual
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 Practica7_3
{
public partial class Form1 : Form
{
double serie ;
int contador ;
double denominador;

public Form1()
{
InitializeComponent();
double serie = 1;
int contador = 1;
double denominador = 0.0;

}

private void button1_Click(object sender, EventArgs e)
{
while (contador < 20)
{
denominador = denominador + 2.0;
listBox1.Items.Add(+denominador);
serie = serie + 1.0 / denominador;
contador++;
}
listBox1.Items.Add("serie"+serie);

}
}
}




Practica 7_3 Pseudocodigo
Print"Serie = 1 + 1.0/2.0 + 1.0/4.0 + 1.0/6.0 + 1.0";
double serie = 1;
int contador = 1;
double denominador = 0.0;
Print("serie= 1+/t");
while (contador < denominador =" denominador" serie =" serie" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 197px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdWaA0Qkk84XiUvLuX-RQdCxOi0gUgE51AM9HOscY8zx3zR022IOxuf2nQlPPpCEcLDdZ2b_3FkpJ-XoqC1LqNsiWETAgB_rVNOn6zNf1Rq2NqLLmg-qq7bo_zP-q3enL2LNnWJt87kBII/s400/7_3c.bmp" alt="" id="BLOGGER_PHOTO_ID_5452312363074878930" border="0">

lunes, 1 de marzo de 2010

practica 6

Practica 6_1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int opcion;
do
{

double area = 0, perimetro = 0, lado = 0,lado1=0,lado2=0,lado3=0, ancho = 0, largo = 0, radio = 0,dma=0,dme=0;
Console.WriteLine("Opciones a elegir");
Console.WriteLine("Calculo de area y perimetro");
Console.WriteLine("\t1)cuadrado\n\t2)Rectangulo\n\t3)Circulo\n\t4)traingulo\n\t5)rombo");
Console.WriteLine("elegir opcion (1-5): ");
opcion = int.Parse(Console.ReadLine());
switch (opcion)
{
case 0: Console.WriteLine("fin de programa");
Console.BackgroundColor=ConsoleColor.Yellow;

break;
case 1: Console.Clear();

Console.Write("\tCalculo area y perimetro de un cuadrado");
Console.Write("Introduce valor de lado");
lado = double.Parse(Console.ReadLine());
area = lado * lado;
perimetro = lado * 4;
break;
case 2: Console.Clear();

Console.WriteLine("\tCalculo area y perimetro de un rectangulo");
Console.Write("Introduce valor de largo : ");
largo = double.Parse(Console.ReadLine());
Console.Write("\tIntroduce valor de ancho : ");
ancho = double.Parse(Console.ReadLine());
area = largo * ancho;
perimetro = 2 * (largo + ancho);
break;
case 3: Console.Clear();
Console.WriteLine("\tcalculo area y perimetro de un circulo");
Console.Write("introduce el valor del radio ");
radio = double.Parse(Console.ReadLine());

area = Math.PI * Math.Pow(radio, 2);
perimetro = 2 * radio * Math.PI;
break;
case 4: Console.Clear();
Console.WriteLine("\tcalculo area y perimetro de un triangulo");
Console.Write("introduce valor del lado 1 ");
lado1 = double.Parse(Console.ReadLine());
Console.Write("Introduce valor del lado 2 ");
lado2 = double.Parse(Console.ReadLine());
Console.WriteLine("introduce valor del lado 3 ");

lado3 = double.Parse(Console.ReadLine());
double p = (lado1 + lado2 + lado3) / 2;


area = Math.Sqrt(p*(p-lado1)*(p-lado2)*(p-lado3));
perimetro = lado1 + lado2 + lado3;
break;

default:
Console.WriteLine("presiono opcion equivocada ");
break;
case 5 :
Console.Clear();
Console.WriteLine("area perimetro de un rombo ");
Console.Write("introduce valor del diagonal menor");
dme = double.Parse(Console.ReadLine());
Console.WriteLine("introduce valor del diagonal mayor ");
dma = double.Parse(Console.ReadLine());
area = (dma * dme) / 2;
perimetro =4*dme;
break;

}
Console.WriteLine("area={0:f2} perimetro={1:f2}", area, perimetro);
Console.ReadKey();

}
while (opcion != 0);
Console.ReadKey();


}
}
}
Practica 6_1
sing 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
{
public Form1()
{
InitializeComponent();
}

private void label1_Click(object sender, EventArgs e)
{

}


private void button1_Click(object sender, EventArgs e)
{ double clado1 = 0 ;

double carea = 0;
double cperimetro = 0;

clado1 = double.Parse(textBox1.Text);
carea = Math.Pow(clado1,2);
cperimetro = clado1 * 4;
label2.Text = ("Area: ") + carea;
label3.Text = ("Perimetro: ") + cperimetro;

double rancho = 0;
double rlargo = 0;
double rarea = 0;
double rperimetro = 0;
rlargo = double.Parse(textBox2.Text);
rancho = double.Parse(textBox3.Text);
rarea = rancho * rlargo ;
rperimetro = 2 * rlargo + 2 * rancho;
label9.Text = ("Area: ") + rarea;
label8.Text = ("Perimetro: ") + rperimetro;


double tlado = 0;
double tbase = 0;
double taltura = 0;
double tarea = 0;
double tperimetro = 0;
tlado = double.Parse(textBox4.Text);
taltura = double.Parse(textBox5.Text);
tbase = double.Parse(textBox6.Text);
tarea = tbase * taltura / 2;
tperimetro = tbase + tlado + tlado;
label14.Text = ("Area: ") + tarea;
label15.Text = ("Perimetro: ") + tperimetro;


double ciradio = 0;
double ciarea = 0;
double ciperimetro = 0;
ciradio = double.Parse(textBox7.Text);
ciarea = 3.1416* Math.Pow(ciradio,2);
ciperimetro = 2*3.1416*ciradio;
label18.Text = ("Area: ") +ciarea;
label19.Text = ("perimetro") +ciperimetro;

double rolado =0;
double rodiagonalma =0;
double rodiagonalme =0;
double roarea = 0;
double roperimetro = 0;
rolado = double.Parse(textBox8.Text);
rodiagonalma = double.Parse(textBox9.Text);
rodiagonalme = double.Parse(textBox10.Text);
roarea = rodiagonalma * rodiagonalme / 2;
roperimetro = 4 * rolado;
label24.Text = ("Area: ") + roarea;
label25.Text = ("Perimetro:") + roperimetro;



6_1Pseudocodigo
1. Definir variables int opcion;
do
{

double area = 0, perimetro = 0, lado = 0,lado1=0,lado2=0,lado3=0, ancho = 0, largo = 0, radio = 0,dma=0,dme=0;
Print"Opciones a elegir";
Print"Calculo de area y perimetro";
Print"t1)cuadrado2)Rectangulo3)Circulo4)traingulo5)rombo";
Print"elegir opcion (1-5): ";
Read opcion;
switch (opcion)
{
case 0: Print"fin de programa";


break;
case 1:

Print"Calculo area y perimetro de un cuadrado";
Print"Introduce valor de lado";
Read lado;
area = lado * lado;
perimetro = lado * 4;
break;
case 2:

Print"Calculo area y perimetro de un rectangulo";
Print"Introduce valor de largo : ";
Read largo;
Print"Introduce valor de ancho : ";
Read ancho:
area = largo * ancho;
perimetro = 2 * (largo + ancho);
break;
case 3:
Print"tcalculo area y perimetro de un circulo";
Print"introduce el valor del radio ";
Read radio

area = Math.PI * Math.Pow(radio, 2);
perimetro = 2 * radio * Math.PI;
break;
case 4:
Print"calculo area y perimetro de un triangulo";
Print"introduce valor del lado 1 ";
read lado1
Print"Introduce valor del lado 2 ";
Read lado 2;
Print"introduce valor del lado 3 ";

Read lado 3
double p = (lado1 + lado2 + lado3) / 2;


area = Math.Sqrt(p*(p-lado1)*(p-lado2)*(p-lado3));
perimetro = lado1 + lado2 + lado3;
break;

default:
Print"presiono opcion equivocada ";
break;
case 5 :

Print"area perimetro de un rombo ";
Print"introduce valor del diagonal menor");
Read dm3
Print"introduce valor del diagonal mayor ";
Read dma;
area = (dma * dme) / 2;
perimetro =4*dme;
break;

}
Print"area= perimetro=", area, perimetro);


}
while (opcion != 0);

Practica 6_2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{

class Program
{
static void Main(string[] args)
{


double franco = 0, libra = 1.84, dracmas = 0, florines = 0, dolar = 1.06, dc = 0, dn = 0, conversion = 0, c2 = 0;
string Opcion;
do {


Console.WriteLine("seleccione Opcion");
Console.WriteLine("Selecciones el tipo de moneda");
Console.WriteLine("\ta)Florines Holandeses a dolares canadienses\n\tb)Dracmas griegas a dolar americano\n\tc)Dolar canadienses a libras britanicas\n\td)Dolares norteamericanos a francos franceses");
Opcion = Console.ReadLine();
switch (Opcion)
{

case "a": Console.Clear();
Console.WriteLine("Introduce la cantidad florines");
florines = double.Parse(Console.ReadLine());
conversion = florines * 43.20 / 100;
Console.WriteLine("Total de dolares canadienses ={0:f2} " , conversion);

Console.ReadKey();
Console.Clear();

break;
case "b": Console.Clear();
Console.WriteLine("Introduce la cantidad de dracmas griegas");
dracmas = double.Parse(Console.ReadLine());
conversion = (dracmas * 2.95 / 100) / dolar;
Console.WriteLine("total de dolares norteamericanos={0:f2}" , conversion);
Console.ReadKey();
Console.Clear();
break;
case "c": Console.Clear();
Console.WriteLine("Introduce la cantidad en dolares");
dc= double.Parse(Console.ReadLine());
conversion = dc / libra;
Console.WriteLine("total de libras ={0:f2}" , conversion);
Console.ReadKey();
Console.Clear();

break;
case "d": Console.Clear();
Console.WriteLine("Introduce la cantidad en dolares");
dn = double.Parse(Console.ReadLine());
conversion = dn * dolar;
c2 = conversion*100/21.55;

Console.WriteLine("total de francos ={0:f2}", c2);
Console.ReadKey();
Console.Clear();

break;
case "F":
case "f": Console.WriteLine("Opcion equivocada");
break;





}

}
while (Opcion != "f" && Opcion != "F") ;


}
}
}

Practica 6_2visual

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
{
florines f;
dracmas d;
dolares_canadienses dc;
dolares_americanos da;
public Form1()
{
InitializeComponent();
f = new florines();
d = new dracmas();
dc = new dolares_canadienses();
da = new dolares_americanos();
}

private void button1_Click(object sender, EventArgs e)
{
f.Show();
}

private void button2_Click(object sender, EventArgs e)
{
d.Show();
}

private void button3_Click(object sender, EventArgs e)
{
dc.Show();
}

private void button4_Click(object sender, EventArgs e)
{
da.Show();
}
}
}

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 dolares_americanos : Form
{
public double t, total, cantidad;
public dolares_americanos()
{
InitializeComponent();
t = total = cantidad = 0;
}

private void button1_Click(object sender, EventArgs e)
{
cantidad = double.Parse(Console.ReadLine());
t = cantidad * 1.06;
total = (t * 100) / 21.55;
label2.Text = "total" + total;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 dolares_canadienses : Form
{
public double cantidad, total;
public dolares_canadienses()
{
InitializeComponent();
total = cantidad = 0;
}

private void button1_Click(object sender, EventArgs e)
{
cantidad = double.Parse(textBox1.Text);
total = cantidad / 1.84;
label2.Text = "total" + total;

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 dolares_canadienses : Form
{
public double cantidad, total;
public dolares_canadienses()
{
InitializeComponent();
total = cantidad = 0;
}

private void button1_Click(object sender, EventArgs e)
{
cantidad = double.Parse(textBox1.Text);
total = cantidad / 1.84;
label2.Text = "total" + total;

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 dolares_canadienses : Form
{
public double cantidad, total;
public dolares_canadienses()
{
InitializeComponent();
total = cantidad = 0;
}

private void button1_Click(object sender, EventArgs e)
{
cantidad = double.Parse(textBox1.Text);
total = cantidad / 1.84;
label2.Text = "total" + total;

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}

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 dracmas : Form
{

public double cantidad, total,t;
public dracmas()
{
InitializeComponent();
total = cantidad =t= 0;
}

private void label1_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
cantidad = double.Parse(textBox1.Text);
t = (cantidad * 2.95) / 100;
total = t * 1.06;
label2.Text = "total" + total;


}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 florines : Form
{
public double total, cantidad;
public florines()

{
InitializeComponent();
total = cantidad = 0;
}

private void button1_Click(object sender, EventArgs e)
{
cantidad = double.Parse(textBox1.Text);
total = (cantidad * 43.20) / 100;
label2.Text = "total"+ total;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
Practica6_2 Pseudocodigo
Declarar variables
double franco = 0, libra = 1.84, dracmas = 0, florines = 0, dolar = 1.06, dc = 0, dn = 0, conversion = 0, c2 = 0;
string Opcion;
do {


Print"seleccione Opcion");
Print"Selecciones el tipo de moneda");
Print"a)Florines Holandeses a dolares canadienses b)Dracmas griegas a dolar americano c)Dolar canadienses a libras britanicas d)Dolares norteamericanos a francos franceses";
Read Opcion
switch (Opcion)
{

case "a":
Print"Introduce la cantidad florines";
Read Florines;
conversion = florines * 43.20 / 100;
Print"Total de dolares canadienses = " , conversion;



break;
case "b":
Print"Introduce la cantidad de dracmas griegas";
Read dracmas;
conversion = (dracmas * 2.95 / 100) / dolar;
Print"total de dolares norteamericanos=" , conversion;

break;
case "c":
Print"Introduce la cantidad en dolares";
Read dc;
conversion = dc / libra;
Print"total de libras =" , conversion;

break;
case "d":
Print"Introduce la cantidad en dolares";
Read dn;
conversion = dn * dolar;
c2 = conversion*100/21.55;

Print"total de francos =", c2;


break;
case "F":
case "f": Print"Opcion equivocada";
break;

Practica 6_3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace practica_6_problema_3
{
class Program
{
static void Main(string[] args)
{
string tipo;
double celsius=0, grado=0, kelvin=0, rankine=0, fahrenheit=0;
do
{
Console.Clear();
Console.WriteLine("Conversiones de Temperaturas");
Console.WriteLine("\nTipo de grados:");
Console.WriteLine("\n\ta)Fahrenheit\n\tb)Celsius\n\tc)Kelvin\n\td)Rankine\n\te)Salir");
Console.Write("\nElegir el tipo de grado que desea convertir: ");
tipo = Console.ReadLine();
switch (tipo)
{
case "A":
case "a": Console.Clear();
Console.Write("\nIntroducir la cantidad de grados Fahrenheit= ");
grado = double.Parse(Console.ReadLine());
celsius = (5.0 / 9.0) * (grado - 32);
kelvin = celsius + 273;
rankine = grado + 460;
Console.WriteLine("\n\tFahrenheit\tCelsius \tKelvin \tRankine");

Console.WriteLine("\t{0:f2} \t{1:f2} °C \t{2:f2} °K \t{3:f2} °R",grado+ "°F",celsius,kelvin,rankine);
break;

case "B":
case "b": Console.Clear();
Console.Write("\nIntroducir la cantidad de grados Celsius= ");
grado = double.Parse(Console.ReadLine());
fahrenheit = (9.0 / 5.0) * grado + 32.00;
kelvin = grado + 273;
rankine = fahrenheit + 460;

Console.WriteLine("\t{0:f2} °C \t{1:f2} °F \t{2:f2} °K \t{3:f2} °R",grado,fahrenheit,kelvin,rankine);
break;

case "C":
case "c": Console.Clear();
Console.Write("\nIntroducir la cantidad de grados Kelvin= ");
grado = double.Parse(Console.ReadLine());
celsius = grado - 273;
fahrenheit = (9.0 / 5.0) * celsius + 32.00;
rankine = fahrenheit + 460;

Console.WriteLine("\t{0:f2} °K \t{1:f2} °C \t{2:f2} °F \t{3:f2} °R",grado,celsius,fahrenheit,rankine);
break;

case "D":
case "d": Console.Clear();
Console.Write("\nIntroducir la cantidad de grados Rankine= ");
grado = double.Parse(Console.ReadLine());
fahrenheit = grado - 460;
celsius = (5.0 / 9.0) * (fahrenheit - 32.00);
kelvin = celsius + 273;

Console.WriteLine("\t{0:f2} °R \t{1:f2} °F \t{2:f2} °C \t{3:f2} °K",grado,fahrenheit,celsius,kelvin);
break;

case "E":
case "e": Console.WriteLine("Fin del programa");
break;

default:
Console.WriteLine("Presiono la opcion equivocada");
break;
}
Console.ReadKey();

}
while(tipo !="e" && tipo !="E");



}
}
}
Practica 6_3 Pseudocodigo
Declarar variables string tipo;
double celsius=0, grado=0, kelvin=0, rankine=0, fahrenheit=0;
do
{

Print"Conversiones de Temperaturas";
Print"Tipo de grados:";
Print"a)Fahrenheit b)Celsius c)Kelvin d)Rankine e)Salir";
Print"Elegir el tipo de grado que desea convertir: ";
Read Tipo
switch (tipo)
{
case "A":
case "a":
Print"Introducir la cantidad de grados Fahrenheit= ";
Read grado
celsius = (5.0 / 9.0) * (grado - 32);
kelvin = celsius + 273;
rankine = grado + 460;
Print"Fahrenheit Celsius Kelvin Rankine";

Print" {0:f2} {1:f2} °C {2:f2} °K {3:f2} °R",grado+ "°F",celsius,kelvin,rankine;
break;

case "B":
case "b":
Print" Introducir la cantidad de grados Celsius= ";
Read grado
fahrenheit = (9.0 / 5.0) * grado + 32.00;
kelvin = grado + 273;
rankine = fahrenheit + 460;

Print"\t{0:f2} °C \t{1:f2} °F \t{2:f2} °K \t{3:f2} °R",grado,fahrenheit,kelvin,rankine;
break;

case "C":
case "c":
Print"Introducir la cantidad de grados Kelvin= ";
Read grado
celsius = grado - 273;
fahrenheit = (9.0 / 5.0) * celsius + 32.00;
rankine = fahrenheit + 460;

Print"\t{0:f2} °K \t{1:f2} °C \t{2:f2} °F \t{3:f2} °R",grado,celsius,fahrenheit,rankine;
break;

case "D":
case "d":
Print"Introducir la cantidad de grados Rankine= ";
Read grado
fahrenheit = grado - 460;
celsius = (5.0 / 9.0) * (fahrenheit - 32.00);
kelvin = celsius + 273;

Print"\t{0:f2} °R \t{1:f2} °F \t{2:f2} °C \t{3:f2} °K",grado,fahrenheit,celsius,kelvin;
break;

case "E":
case "e": Print"Fin del programa";
break;

default:
Print"Presiono la opcion equivocada");
break;
}


}
while(tipo !="e" && tipo !="E");



Practica 6_3visual
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
{
fahrenheit f;
celsius c;
kelvin k;
rankine r;
public Form1()
{
InitializeComponent();
f = new fahrenheit();
c = new celsius();
k =new kelvin();
r = new rankine();

}

private void button3_Click(object sender, EventArgs e)
{
k.Show();
}

private void button1_Click(object sender, EventArgs e)
{
f.Show();
}

private void button2_Click(object sender, EventArgs e)
{
c.Show();
}

private void button4_Click(object sender, EventArgs e)
{
r.Show();
}
}
}
sing 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 celsius : Form
{
public double grado , kr , rr, fr ;
public celsius()
{
InitializeComponent();
grado = kr = rr= fr = 0;
}

private void button1_Click(object sender, EventArgs e)
{
grado = double.Parse(textBox1.Text);
fr = (9.0 / 5.0) * grado + 32.00;
kr = grado + 273;
rr = fr + 460;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
label3.Text = "";
label4.Text = "";
}
}
}
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 fahrenheit : Form
{
public double cr, grado, kr, rr;
public fahrenheit()
{
InitializeComponent();
cr= grado= kr= rr= 0;
}

private void button1_Click(object sender, EventArgs e)
{
grado = double.Parse(textBox1.Text);
cr = (5.0 / 9.0) * (grado - 32);
kr = cr + 273;
rr = grado + 460;
label2.Text = "C"+cr;
label3.Text = "K"+kr;
label4.Text = "R" + rr;

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
label3.Text = "";
label4.Text = "";

}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 kelvin : Form
{
public double cr, grado, kr, rr, fr;
public kelvin()
{
InitializeComponent();
cr= grado = kr = rr = fr = 0;
}

private void button1_Click(object sender, EventArgs e)
{
grado = double.Parse(textBox1.Text);
cr = grado - 273;
fr = (9.0 / 5.0) * cr+ 32.00;
rr= fr + 460;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
label3.Text = "";
label4.Text = "";
}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 rankine : Form
{
public double cr, grado, kr, rr, fr;
public rankine()
{
InitializeComponent();
cr = grado = kr = rr = fr = 0;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = "";
label3.Text = "";
label4.Text = "";
}


private void button1_Click(object sender, EventArgs e)
{
grado = double.Parse(textBox1.Text);
fr = grado - 460;
cr = (5.0 / 9.0) * (fr - 32.00);
kr = cr + 273;

}

private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}

lunes, 22 de febrero de 2010

practica 5


Practica 5_1 visual


sing 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
{
double ga;
double mi;
double rendimiento;
public Form1()
{
InitializeComponent();
ga = mi = rendimiento=0;
}

private void button1_Click(object sender, EventArgs e)
{
mi = double.Parse(textBox1.Text);
ga = double.Parse(textBox2.Text);
rendimiento = mi / ga;
label3.Text = "rendimiento millas por galon = " + rendimiento;
}
}
}

Practica 5_1 consola

using System;
using System.Collections.Generic;

using System.Linq;
using System.Text; namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{

Console.WriteLine("Introduzca las millas recorridas: ");

double millas = Double.Parse(Console.ReadLine());
Console.WriteLine("\nIntroduzca los galones de gasolina consumidos");
double galones = double.Parse(Console.ReadLine());
double rendimiento = millas/galones;
Console.WriteLine ("la cantida consumida millas por galon es = {0:f4}", rendimiento); Console.ReadKey();
}
}
}


Practica 5_2 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
{
double r, a, b, c, x;
public Form1()
{
InitializeComponent();
r = a = b = c = x = 0;
}
private void button1_Click(object sender, EventArgs e)
{
a = double.Parse(textBox1.Text);
b = double.Parse(textBox2.Text);
c = double.Parse(textBox3.Text);
x = double.Parse(textBox4.Text);
r = a * Math.Pow(x, 2) + b * x + c;
label5.Text = "el resultado del polinomio es " + r;
}
private void button2_Click(object sender, EventArgs e)
{

textBox1.Clear();

textBox2.Clear();
textBox3.Clear();

textBox4.Clear();
textBox1.Focus();
}
}

}

Practica 5_2 consola

using System;
using System.Collections.Generic;

using System.Linq; using System.Text;
namespace ConsoleApplication1
{
class Program

{

static void Main(string[] args)
{
Console.WriteLine("Programa que calcula el valor de polinomio de segundo orden");
Console.WriteLine("introduce el valor de A"); double a = double.Parse(Console.ReadLine()); Console.WriteLine("introduce el valor de B"); double b = double.Parse(Console.ReadLine()); Console.WriteLine("introduce el valor de C"); double c = double.Parse(Console.ReadLine()); Console.WriteLine("introduce el valor de X "); double x = double.Parse(Console.ReadLine()); double resultado = a*Math.Pow(x,2) + b*x + c;
Console.WriteLine(" el valor del polinomio es = " + resultado);
Console.ReadKey();

}
}
}


Practica 5_3 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
{
double angulo;
public Form1()
{
InitializeComponent();
angulo = 0;
}

private void button1_Click(object sender, EventArgs e)
{
angulo = double.Parse(textBox1.Text);
if (angulo < text="angulo agudo" angulo ="=" text="angulo recto" text="angulo obtuso " text = " ">

practica 5_3 consola

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Introduce el angulo"); double angulo = double.Parse(Console.ReadLine()); if (angulo <> { Console.WriteLine("angulo agudo"); } else { if (angulo == 90) { Console.WriteLine("angulo recto"); } else { Console.WriteLine("angulo obtuso "); } } Console.ReadKey(); } } }



Practica 5_4 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
{
double c1,c2,c3,c4,c5, promedio;
string nombre;
public Form1()
{
InitializeComponent();
c1 = c2 = c3 = c4 = c5 = promedio = 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);
promedio = (c1 + c2 + c3 + c4 + c5) / 5;
if (promedio >= 70)
{
label7.Text = "alumno aprobado " + nombre + "promedio " + promedio;
}
else
{
label7.Text = "alumno no acreditado " + nombre + " promedio " + promedio;
}


}

private void button2_Click(object sender, EventArgs e)
{

}
}
}


Practica 5_4 consola


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Introduce nombre del alumno");
string nombre = Console.ReadLine();
Console.WriteLine("Introduce calficacion 1");
double c1 = double.Parse(Console.ReadLine());
Console.WriteLine("Introduce calficacion 2");
double c2 = double.Parse(Console.ReadLine());
Console.WriteLine("Introduce calficacion 3");
double c3 = double.Parse(Console.ReadLine());
Console.WriteLine("Introduce calficacion 4");
double c4 = double.Parse(Console.ReadLine());
Console.WriteLine("Introduce calficacion 5");
double c5 = double.Parse(Console.ReadLine());
double promedio = (c1 + c2 + c3 + c4 + c5) / 5;
if (promedio >= 70)
{
Console.WriteLine("alumno aprobado " + nombre + " Promedio {0:f4} " , promedio);
}
else
{
Console.WriteLine("alumno no acreditado " + nombre + " Promedio {0:f4} " , promedio);
}

Console.ReadKey();

}
}
}

practica 5_5






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n1, n2, n3, n4, n5, mayor = 0;
Console.Write("introduce numero 1:");
n1 = int.Parse(Console.ReadLine());
Console.Write("introduce numero 2:");
n2 = int.Parse(Console.ReadLine());
Console.Write("introduce numero 3:");
n3 = int.Parse(Console.ReadLine());
Console.Write("introduce numero 4:");
n4 = int.Parse(Console.ReadLine());
Console.Write("introduce numero 5:");
n5 = int.Parse(Console.ReadLine());
if (n1 >= n2 && n1 >= n3 && n1 >= n4 && n1 >= n5)
{
mayor = n1;
}
else
{
if (n2 >= n1 && n2 >= n3 && n2 >= n4 && n2 >= n5)
{
mayor = n2;
}
else
{
if (n3 >= n1 && n3 >= n2 && n3 >= n4 && n3 >= n5)
{
mayor = n3;
}
else
{
if (n4 >= n1 && n4 >= n2 && n4 >= n3 && n4 >= n5)
{
mayor = n4;
}
else
{
if (n5 >= n1 && n5 >= n2 && n5 >= n3 && n5 >= n4)
{
mayor = n5;
}
}
}
}
}
Console.WriteLine("el dato mayor es {0} ", mayor);
Console.ReadKey();
}
}
}





practica 5_5 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 n1, n2, n3, n4, n5, mayor;
public Form1()
{
InitializeComponent();
n1 = n2 = n3 = n4 = n5 = mayor = 0;
}

private void button1_Click(object sender, EventArgs e)
{
n1 = int.Parse(textBox1.Text);
n2 = int.Parse(textBox2.Text);
n3 = int.Parse(textBox3.Text);
n4 = int.Parse(textBox4.Text);
n5 = int.Parse(textBox5.Text);
if (n1 >= n2 && n1 >= n3 && n1 >= n4 && n1 >= n5)
{
mayor = n1;
}
else
{
if (n2 >= n1 && n2 >= n3 && n2 >= n4 && n2 >= n5)
{
mayor = n2;
}
else
{
if (n3 >= n1 && n3 >= n2 && n3 >= n4 && n3 >= n5)
{
mayor = n3;
}
else
{
if (n4 >= n1 && n4 >= n2 && n4 >= n3 && n4 >= n5)
{
mayor = n4;
}
else
{
if (n5 >= n1 && n5 >= n2 && n5 >= n3 && n5 >= n4)
{
mayor = n5;
}
}
}
}
}
label6.Text = " el dato mayor " + mayor;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox1.Focus();
}
}
}

miércoles, 17 de febrero de 2010




Practica 4 problema 4










using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// progrma que calcula la distancia entre dos puntos
// Gamez Cardenas Enrique 09210799
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double x1, x2, y1, y2, distancia = 0;
Console.Write("introduce el valor x1: ");
x1 = double.Parse(Console.ReadLine());
Console.Write("introduce el valor y1: ");
y1 = double.Parse(Console.ReadLine());
Console.Write("introduce el valor x2: ");
x2 = double.Parse(Console.ReadLine());
Console.Write("introduce el valor y2: ");
y2 = double.Parse(Console.ReadLine());
distancia= Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2));
Console.WriteLine("primer punto (" + x1 + "," + y1 + ")");
Console.WriteLine("segundo punto (" + x2 + "," + y2 + ")");
Console.WriteLine("la distancia = " + distancia);
Console.ReadLine();

}
}
}