domingo, 8 de noviembre de 2009

Practica # 8.2(a ,b y c)

PSEUDOCODIGO
int[] emax = new int[10];
int I, mayor;
PRINT("Introduce un munero entero");
READ emax[0]
mayor = emax[0];
for (I = 1; I <>
{PRINT("Introduce dato{0}", I);
READ emax[I]
if (emax[I] > mayor)
{
mayor = emax[I];
}
}
PRINT("Lista de 10 numeros enteros");
for (I = 0; I <>
{
PRINT(emax[I]);
}
PRINT("el valor maximo es {0}: ", mayor);

FIN
CODIGOS EN CONSOLA (A)



int[] emax = new int[10];
int I, mayor;
Console.WriteLine("Introduce un munero entero");
emax[0] = int.Parse(Console.ReadLine());
mayor = emax[0];
for (I = 1; I <> mayor)
{
mayor = emax[I];
}
}

Console.WriteLine("Lista de 10 numeros enteros");
for (I = 0; I <>
CODIGOS EN WINDOWS (A)

public partial class Form1 : Form
{
int[] Emax = new int[10];
int I, mayor, pos = 0;
public Form1()
{
InitializeComponent();
I = 0;
listBox1.Items.Add("Valores enteros:");
}

private void button1_Click(object sender, EventArgs e)
{
if (I < i ="="" mayor =" Emax[0];"> mayor)
{
mayor = Emax[I];
pos = I;
}

I++;
}

else
{
button1.Enabled = false;
}
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Add ("El valor maximo es: " + mayor.ToString());
listBox1.Items.Add ("Posicion numero: " + pos.ToString());
}

CODIGOS EN CONSOLA (B)
int[] emax = new int[10];
int I, mayor, pos = 0;

Console.WriteLine("Introduce un munero entero");
emax[0] = int.Parse(Console.ReadLine());
mayor = emax[0];
for (I = 1; I <> mayor)
{
mayor = emax[I];
pos = I;

}
}

Console.WriteLine("Lista de 10 numeros enteros");
for (I = 0; I <>

Practica # 8.1(Promedio)

PSEUDOGODIGO
INT N;
[] INT VALORES;
PRINT (“Introduce numero de elementos");
READ N;
VALORES = NEW INT [N];
INT I;
INT sumapar=0;
INT sumaimpar=0;
FOR (I=0; I
PRINT (“Introduce valores enteros”);
READ VALORES[I];
IF ( VALORES [I]%2==0);
{
SUMAPAR +=VALORES[I];
}
ELSE
{
SUMIMPAR +=VALORES [I];
}}
PRINT (“Numeros pares:”);
FOR (I=0; I
{
IF (VALORES [I]%2==0)
{
PRINT VALORES [I];
}
}

PRINT ();
PRINT (“suma de los numeros pares”, sumapar)
PRINT (“NUMEROS IMPARES :”)
FOT ( I=0; I
{
IF (VALORES [I] %2==1)
{
PRINT (VALORES [I]);
}
}
PRINT ();
PRINT (“suma de numeros impares”, sumaimpar);
FIN
CODIGO EN CONSOLA
int[] temp = new int[8];
int suma = 0, I, P;
Console.WriteLine("Introduce los siguientes valores enteros:");
for (I = 0; I <>
{
Console.Write("Dato {0}:", I);
temp[I] = int.Parse(Console.ReadLine());
suma += temp[I];
}
P = suma / 8;
Console.WriteLine("\nLista de los 8 valores enteros:");

for (I = 0; I <>
{
Console.WriteLine("\t" + temp[I]);
}
Console.WriteLine("Promedio = {0}", P);
Console.ReadKey();
CODIGO EN WINDOWS



public partial class Form1 : Form
{
int[] temp;
int I, suma, P;
public Form1()
{
InitializeComponent();
temp = new int[8];
I = suma = P = 0;
listBox1.Items.Add("NUMEROS ENTEROS");
}

private void button1_Click(object sender, EventArgs e)
{
if (I < suma =" suma" enabled =" false;" enabled =" false;" p =" suma" promedio="">

Practica # 6 (Poblacion)

PSEUDOCODIGO
Inicio
double t = 0.0;
double p;
for (t = 1994; t <=2010; t = t + 1)
{
p=4.8*(1+ Math.Exp(0.02*t));
Print("t y p");
}
Fin

CODIGO EN CONSOLA

double t = 0.0;
double p;
for (t = 1994; t <= 2010; t = t + 1)
{
p = 4.8 * (1 + Math.Exp(0.02 * t));
Console.WriteLine("En el año " + t + " la poblacion era igual a = " + p);
}
Console.ReadLine();

CONSOLA EN WINDOWS
double t = 0.0;
double p;
for (t = 1994; t <= 2010; t = t + 1)
{
p = 4.8 * (1 + Math.Exp(0.02 * t));
listBox1.Items.Add("En el año " + t + " la poblacion era igual a = " + p);
}

Practica # 6( funciones matematicas a , b y c )

PSEUDOCODIGOS

A
Inicio
Real x,y
Print("funcion Matematica")
Print ("valores x valores y ")
for(x=2 to 10) step 0.2
{
y= 3* x ^5 + 2 * x ^3 + x
Print (x y )
}
FIN

CODIGO EN CONSOLA
double x = 0.0, y;
for (x = 1; x <= 10; x = x + 2.0 / 10.0)
{
y = 3 * Math.Pow(x, 5) + 2 * Math.Pow(x, 3) + x;
Console.WriteLine(x + " 3x^5 + 2x ^3 + x = " + y);
}
Console.ReadLine();

WINDOWS

PSEUDOCODIGOS
B
Inicio
Real x,y
Print("funcion Matematica")
Print ("valores x valores y ")
for(x=1 to 5) step 0.1
{
y=1 + x + x^2/ 2.0 + x^3 /6.0 + x^4 /24.0
Print (x y )
}
FIN

CODIGO EN CONSOLA
double x = 0.0, y;
for (x = 1; x <= 5; x = x + 1.0 / 10.0)
{
y = 1.0 + x + Math.Pow(x, 2) / 2.0 + Math.Pow(x, 3) / 6.0 + Math.Pow(x, 4) / 24;
Console.WriteLine(x + " 1.0 + x + x^2/2.0 + x^3/6.0 + x^4/24 = " + y);
}
Console.ReadLine();
WINDOWS

PSEUDOCODIGOS
C
Inicio
Real t,y
Print("funcion Matematica")
Print ("valores t valores y ")
for(x=2 to 10) step 0.2
{
y= 2 * Exp( 0.8 * t )
Print (t y )
}
FIN
CODIGO EN CONSOLA
double t = 0.0, y;
for (t = 5; t <= 10; t = t + 0.5)
{
y = 2 * Math.Exp(0.8 * t);
Console.WriteLine(t + " 2e^(0.8*t) " + y);
}
Console.ReadLine();


prantica # 6 (FACTORIAL)

PSEUDOCODIGO

INICIO
double n,factor =1.0,I;
Read n
for(I = n;I>1; I--)
{
factor =factor*1;
Print factor
}
FIN
CODIGO EN CONSOLA

double n, factor = 1.0, I;
Console.WriteLine("Introduce un Valor entero");
n = double.Parse(Console.ReadLine());
for (I = n; I >= 1; I--)
{
factor = factor * I;

}
Console.WriteLine(" EL factorial es " + factor);
Console.ReadLine()

CODIGO EN WINDOWS


double n, factor = 1.0, I;
n = double.Parse(textBox1.Text);
for (I = n; I >= 1; I--)
{
factor = factor * I;

}
textBox2.Text = factor.ToString();
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();

martes, 3 de noviembre de 2009

PRACTICA # 9(V) CALIFICACIONES Y PROMEDIOS



public partial class Form1 : Form
{
int[] calificaciones;
int[] desviacion;
int i, suma, variancia, promedio;
public Form1()
{
InitializeComponent();
calificaciones = new int[] { 89, 95, 72, 83, 99, 54, 86, 75, 92, 73, 79, 75, 82, 73 };
desviacion = new int[14];
suma = i = variancia = promedio = 0;
}


private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("calicicacion DEsviacion");
for (i = 0; i< 14; i++)
{
suma = suma + calificaciones[i];
}
promedio = suma / 14;
for (i = 0; i < 14; i++)
{
desviacion[i] = calificaciones[i] - promedio;
listBox1.Items.Add(calificaciones[i]+"\t"+desviacion[i]);
}
suma=0;
for (i = 0; i < 14; i++)
{
suma = suma + desviacion[i]*desviacion[i];
}
variancia = suma / 14;
listBox1.Items.Add("la variancia es " + variancia);
}
}
}

PRACTICA # 9(C) CALIFICACIONES Y PROMEDIOS




namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] calificaciones = { 89, 95, 72, 83, 99, 54, 86, 75, 92, 73, 79, 75, 82, 73 };
int[] desviacion = new int[14];
int suma = 0, varianza, promedio;
int I;
for (I = 0; I < 14; I++)
{
suma = suma + calificaciones[I];
}
promedio = suma / 14;
for (I = 0; I < 14; I++)
{
desviacion[I] = calificaciones[I] - promedio;
}
Console.WriteLine("CALIFICACION DESVIACION ");
for (I = 0; I < 14; I++)
{
Console.WriteLine("\t{0}\t{1}", calificaciones[I], desviacion[I]);
}
suma = 0;
for (I = 0; I < 14; I++)
{
suma = suma + (desviacion[I] * desviacion[I]);
}
varianza = suma / 14;
Console.WriteLine("\n LA VARIANZA ES =" + varianza);
Console.ReadKey();
}
}
}