miércoles, 26 de noviembre de 2008

Practica 13

Problema 1
using System;
using System.Collections.Generic;
using System.Text;
namespace Practica13
{
class Program
{
static void Main(string[] args)
{
Arreglo A1 = new Arreglo(5);
int I, dato;
for (I = 0; I <>
{
Console.Write("Introduce dato {0}:",(I + 1));
dato = int.Parse(Console.ReadLine()); A1.insertardato(I, dato); }
Console.WriteLine("\nLa suma es: {0}",A1.sumadatos(5));
Console.WriteLine("El dato mayor es: {0}", A1.mayor(5));
Console.WriteLine("El dato menor es: {0}", A1.menor(5));
Console.WriteLine("El promedio es: {0} ", A1.promedio(5));
Console.ReadLine(); } } }





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica13v
{
public partial class Calcular : Form
{

double[] dato ;
double may, men,suma, promedio;
int I;
public Calcular()
{
InitializeComponent();
dato = new double [5];
I = 0;
}
private void tdato_Click(object sender, EventArgs e)
{
if (I <>
suma = suma + dato[I];
promedio = suma / 5;
tbd.Clear(); I++;
if (I == 5) { tbd.Enabled = false;
} } }
private void button1_Click(object sender, EventArgs e)
{ may = dato[0];
for (I = 0; I <> may)
{ may = dato[I]; }
}
men = dato[0];
for (I = 0; I <>
{ if ( dato[I]< men =" dato[I];">
} } label2.Text = ("La suma es: " + suma.ToString());
label3.Text = ("El dato mayor es: " + may.ToString());
label4.Text = ("El dato menor es: " + men.ToString());
label5.Text = ("El promedio es: " + promedio.ToString());
} private void Limpiar_Click(object sender, EventArgs e)
{ tbd.Clear(); tbd.Enabled = true;
label2.Text = ""; label3.Text = "";
label4.Text = ""; label5.Text = "";
} } }

martes, 18 de noviembre de 2008

Practica 12



Problema 1

using System;
using System.Collections.Generic;
using System.Text;
namespace Practica12_problema_1c
{
class Program
{
static void Main(string[] args)
{int I;
double[] corriente = new double[10];
double[] voltaje = new double[10];
double[] resistencia = new double[10];
for(I=0; I<10; I++)
{
Console.Write("introduce valor de resistencia {0}:",I+1);
resistencia[I] =double.Parse (Console.ReadLine());
}
Console.WriteLine("");
for (I = 0; I < 10; I++)
{
Console.Write("Introduce corriente {0}:",I+1);
corriente[I] = double.Parse(Console.ReadLine());
voltaje[I] = (corriente[I] * resistencia[I]);
}
Console.WriteLine("\n\tCorriente "+"Resisntecia "+" Voltios");
for (I = 0; I < 10; I++)
{
Console.WriteLine("\t "+corriente[I]+" "+resistencia[I]+" "+voltaje[I]);
}
Console.ReadLine();
}
}
}


lunes, 10 de noviembre de 2008

Practica 11

Problema1
using System;
using System.Collections.Generic;
using System.Text;
namespace Practica11_problema_1c
{
class Program
{
static void Main(string[] args)
{
double e, R, suma, promedio, r;
for (e = 1; e <= 4; e = e + 1) { Console.WriteLine("\nExperimento " + e);
suma = 0; for (R = 1; R <= 6; R = R + 1)
{
Console.Write("Introdusca el resultado {0}:", R);
r = double.Parse(Console.ReadLine()); suma = suma + r;
}
promedio = suma / 6;
Console.WriteLine("\nSu promedio de ensaye es:" + promedio);
Console.ReadLine(); } } } }



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica11_problema_1v
{
public partial class Form1 : Form
{
double[] n1;
double[] n2;
double[] n3;
double[] n4;
double[] n5;
double[] n6;
double[] suma;
double[] promedio;
int I=0;
public Form1()
{
InitializeComponent();
n1 = new double[6];
n2 = new double[6];
n3 = new double[6];
n4 = new double[6];
n5 = new double[6];
n6 = new double[6];
suma= new double[4];
promedio=new double[4];
}
private void Calcular_Click(object sender, EventArgs e)
{
for (I = 0; I < i =" I">

{ list.Items.Add ( "El experimento "+( I ));

list.Items.Add ("La suma es: " + suma[I]);

list.Items.Add ("El promedio es:" + promedio[I]);

list.Items.Add("");

} } private void Limpiar_Click(object sender, EventArgs e)

{ tbn2.Clear();

tbn3.Clear();

tbn4.Clear();

tbn5.Clear();

tbn6.Clear();

tbn1.Clear();

tbn1.Text = "0";

tbn2.Text = "0";

tbn3.Text = "0";

tbn4.Text = "0";

tbn5.Text = "0";

tbn6.Text = "0";

label7.Text = "";

label8.Text = "";

tbn1.Enabled = true;

tbn2.Enabled = true;

tbn3.Enabled = true;

tbn4.Enabled = true;

tbn5.Enabled = true;

tbn6.Enabled = true;

list.Items.Clear();

}

private void Salir_Click(object sender, EventArgs e)

{ Close(); }

private void Dato_Click(object sender, EventArgs e)

{ if (I <>

{ n1[I] = double.Parse(tbn1.Text);

n2[I] = double.Parse(tbn2.Text); n3[I] = double.Parse(tbn3.Text); n4[I] = double.Parse(tbn4.Text);

n5[I] = double.Parse(tbn5.Text); n6[I] = double.Parse(tbn6.Text);

suma[I] = n1[I] + n2[I] + n3[I] + n4[I] + n5[I] + n6[I];

promedio[I] = suma[I] / 6;

tbn1.Clear();

tbn2.Clear();

tbn3.Clear();

tbn4.Clear();

tbn5.Clear();

tbn6.Clear();

I++; } if (I == 4) { tbn1.Enabled = false;

tbn2.Enabled = false;

tbn3.Enabled = false; tbn4.Enabled = false;

tbn5.Enabled = false; tbn6.Enabled = false; } } } }




Problema2

using System;
using System.Collections.Generic;
using System.Text;
namespace Practica11problema_2c
{
class Program
{
static void Main(string[] args)
{
double sumag, G, V, sumavol,voltaje,promg,prom;
sumag=0;
Console.Write("introduce el voltaje para los generadores");
for(G=1; G<=6; G=G+1)
{
sumavol=0;
Console.WriteLine("\n"+G+"Generador");
for(V=1; V<=3; V=V+1)
{
Console.Write("introduce voltaje{0}:",V);
voltaje=double.Parse(Console.ReadLine());
sumavol=sumavol+voltaje; } prom = sumavol / 3;
sumag = sumag + prom;
Console.WriteLine("\nSu voltaje promedio es: "+prom);
} promg = sumag / 5;
Console.Write("El promedio de voltaje de todos los generadores es: ");
Console.WriteLine(""+promg);
Console.ReadLine();
} } }

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Prcatica11_problema_2v
{
public partial class Form1 : Form
{
double[] v1;
double[] v2;
double[] v3;
double[] volprom;
double[] sumavol;
double[] dato;
int I;
public Form1()
{
InitializeComponent();
v1 = new double[5];
v2 = new double[5];
v3 = new double[5];
dato = new double[5];
volprom = new double[5];
sumavol = new double[5];
I = 0;
}
private void Calcular_Click(object sender, EventArgs e)
{
for (I = 0; I < i =" I">
{
list.Items.Add("Generador:" + dato[I]);
list.Items.Add("El voltaje promedio es:" + volprom[I]);
list.Items.Add("" );
} } private void Salir_Click(object sender, EventArgs e)
{ Close();
} private void Limpiar_Click(object sender, EventArgs e) { tbv1.Clear(); tbv2.Clear(); tbv3.Clear(); tbv1.Text = ""; tbv2.Text = "";
tbv3.Text = "";
list.Items.Clear(); tbv1.Enabled = true;
tbv2.Enabled = true;
tbv3.Enabled = true; }
private void Dato_Click(object sender, EventArgs e)
{ if (I <>
v2[I] = double.Parse(tbv2.Text);
v3[I] = double.Parse(tbv3.Text);
sumavol[I] = v1[I] + v2[I] + v3[I];
volprom[I] = sumavol[I] / 3;
dato[I]=I+1;
tbv1.Clear(); tbv2.Clear();
tbv3.Clear(); I++; } if (I == 5)
{ tbv1.Enabled = false; tbv2.Enabled = false;
tbv3.Enabled = false; } } } }




Problema3
using System;
using System.Collections.Generic;
using System.Text;
namespace Practica11_problema_3c
{
class Program
{
static void Main(string[] args)
{
int mayor, posmayor, menor, posmen, suma = 0, prom;
int[] Elementos = new int[5];
int I;
Console.WriteLine("Introduce siguientes valores");
for (I = 0; I < mayor =" Elementos[0];" posmayor =" 0;" i =" 1;"> mayor)
{
mayor = Elementos[I];
posmayor = I;
}
}
Console.WriteLine("\nEl dato mayor es: " + mayor);
Console.WriteLine("Su posicion es: " + posmayor);
menor = Elementos[0];
posmen = 0;
for (I = 1; I <>
{ menor = Elementos[I]; posmen = I; }
}
Console.WriteLine("\nEl dato menor es: " + menor);
Console.WriteLine("Su posicion es: " + posmen);
suma = 0; for (I = 0; I <>
suma = suma + Elementos[I];
}
prom = suma / 5;
Console.WriteLine("El promedio de los elementos es: " + prom);
Console.ReadLine();
} } }



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica11_problema_3v
{
public partial class Form1 : Form
{
double suma;
double prom;
double[] x; int I;
public Form1()
{
InitializeComponent();
x = new double[10];
I = 0;
suma = 0;
}
private void Calcular_Click(object sender, EventArgs e)
{
double mayor = x[0];
double posmay = 0;
double menor = x[0];
double posmen = 0;
mayor = x[0];
for (I = 1; I <> mayor)
{ mayor = x[I];
posmay = I+1;
}
}
menor = x[0];
for (I = 1; I <>
{
if (x[I] <>
{
menor = x[I]; posmen = I+1;
} }
label2.Text = "El dato menor es " + menor.ToString() + " su pososcion es " + posmen.ToString(); label3.Text = "El dato mayor es " + mayor.ToString() + " su posicion es " + posmay.ToString(); { label4.Text = "Su promedio es " + prom.ToString();
} } private void button1_Click(object sender, EventArgs e) { if (I <>
{ x[I] = double.Parse(tbx.Text);
suma = suma + x[I]; prom = suma / 10;
tbx.Clear(); I++;
if (I == 10) { tbx.Enabled = false;
} } } private void Limpiar_Click(object sender, EventArgs e)
{ tbx.Clear();
tbx.Text = "0";
label2.Text = "";
label3.Text = "";
label4.Text = "";
tbx.Enabled = true;
} private void Salir_Click(object sender, EventArgs e)
{ Close();
} } }

martes, 4 de noviembre de 2008

Practica 10

Problema 1

using System;
using System.Collections.Generic;
using System.Text;
namespace Examen_1al_99
{
class Program
{
static void Main(string[] args)
{
double I;
Console.WriteLine("Numero" + " Cuadrado");
for (I = 1; I <= 99; I = I + 2)
{
Console.WriteLine("" + I + "\t " + I * I);
}
Console.ReadLine();
}
}
}













Problema 2

using System;
using System.Collections.Generic;
using System.Text;
namespace Examen_xy
{
class Program
{
static void Main(string[] args)
{
double x, y;
Console.WriteLine("X" + " \t Y");
for (x = 5; x <= 10; x = x + 0.02)
{ y = (3 * x * x * x - 2 * x * x + x);
Console.WriteLine("" + x + " \t " + y); }
Console.ReadLine();
}
}
}








Problema 3

using System;
using System.Collections.Generic;
using System.Text;
namespace Examen_2_al_200
{
class Program
{
static void Main(string[] args)
{
double I, suma;
suma = 0;
for (I = 2; I <= 200; I = I + 2)

{ suma = suma + I; if (I >= 200)
{
Console.WriteLine("La suma es: {0}", suma);
}
}
Console.ReadLine();
}
}
}














Problema 4

using System;
using System.Collections.Generic;
using System.Text;
namespace Examen_grados
{
class Program
{
static void Main(string[] args)
{
double vinicial, vfinal, celcius, I;
Console.WriteLine("Introduce la temperatura inicial en grados fahrenheit");
vinicial = double.Parse(Console.ReadLine());
Console.WriteLine("Introduce el valor final en grados fahrenheit");
vfinal = double.Parse(Console.ReadLine());
Console.WriteLine("\nFahrenheit" + "\t Celcius");
for (I = vinicial; I <= vfinal; I = I + 2) { celcius = (5.0 / 9.0) * (I - 32);
Console.WriteLine("" + I + " " + celcius); }
Console.ReadLine();
}
}
}