miércoles, 28 de octubre de 2009

Practica 8.2 c) 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_8_2_W_c
{
public partial class Form1 : Form
{
int[] Emax = new int[10];
int I, menor, pos = 0;
public Form1()
{
InitializeComponent();
I = 0;
listBox1.Items.Add("Valores enteros:");

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{

if (I < 10)
{


Emax[I] = int.Parse(textbox1.Text);
if (I == 0)
{


menor = Emax[0];
}
textbox1.Clear();
textbox1.Focus();

listBox1.Items.Add(I.ToString() + ":\t" + Emax[I].ToString());

if (Emax[I] < menor)
{
menor = Emax[I];
pos = I;
}

I++;
}

else
{
button1.Enabled = false;
}

}



private void button3_Click(object sender, EventArgs e)
{
textbox1.Clear();
listBox1.Items.Clear();
button1.Enabled = true;
}

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

private void button2_Click_1(object sender, EventArgs e)
{
MessageBox.Show("El valor minimo es: " + menor.ToString() + "\nPosicion numero: " + pos.ToString());
}
}
}

Practica 8.2 b) y c) Visual

Pseudocódigo

int[] emax = new int[10]
int I, mayor
Print ("Introduce un numero entero")
Read emax[0]
mayor = emax[0]
for (I = 1; I < 10; I++)
{
Print ("Introduce dato []", I)
Read emax[I]
if (emax[I] > mayor)
{
mayor = emax[I]
}
}
Print ("Listado de 10 nuemros enteros")
for (I = 0; I < 10; I++)
{
Print (emax[I]);
}
Raed ("El valor maximo es ", mayor)
Fin













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_8_2
{
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 Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
if (I <>
{


Emax[I] = int.Parse(textbox1.Text);
if (I == 0)
{


mayor = Emax[0];
}
textbox1.Clear();
textbox1.Focus();

listBox1.Items.Add(I.ToString() + ":\t" + Emax[I].ToString());

if (Emax[I] > mayor)
{
mayor = Emax[I];
pos = I;
}

I++;
}

else
{
button1.Enabled = false;
}





}

private void button3_Click(object sender, EventArgs e)
{
textbox1.Clear();
listBox1.Items.Clear();
button1.Enabled = true;

}

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

private void button2_Click_1(object sender, EventArgs e)
{

MessageBox.Show("El valor maximo es: " + mayor.ToString() + "\nPosicion numero: " + pos.ToString());
}
}
}

martes, 27 de octubre de 2009

Practica 8.3 Visual


PSEUDOCODIGO
int[] emax = new int[10];
int I, mayor;
PRINT("Introduce un munero entero");
READ emax[0]
mayor = emax[0];
for (I = 1; I < 10; 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 < 10; I++)
{
PRINT(emax[I]);
}

PRINT("el valor maximo es {0}: ", mayor);
Console.ReadLine();















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[] corriente;
int[] resistencia;
int[] voltios;
int i;

public Form1()
{
InitializeComponent();

corriente = new int[10];
resistencia = new int[10];
voltios = new int[10];
i = 0;
}

private void button1_Click(object sender, EventArgs e)
{
if(i<10)
{
corriente[i]=int.Parse(textBox1.Text);
resistencia[i]=int.Parse(textBox2.Text);
voltios[i]=corriente[i]*resistencia[i];
textBox1.Clear();
textBox1.Focus();
textBox2.Clear();
textBox2.Focus();
i++;


}
else
{
textBox1.Clear();
textBox1.Enabled=false;
button1.Enabled=false;
textBox2.Clear();
textBox2.Enabled = false;

}
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Add("Corriente Resistencia Voltios");
for (i=0;i<10;i++)
{

listBox1.Items.Add(corriente[i].ToString()+"\t\t"+ resistencia[i].ToString()+"\t\t"+voltios[i].ToString());
}
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}
}

Practica 8.3 Consola


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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int I;
double[] corriente = new double[10];
double[] voltios = new double[10];
double[] resistencia = new double[10];
for (I = 0; I < 10; I++)
{
Console.Write("INTRODUCE DATO PARA 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());
voltios[I] = (corriente[I] * resistencia[I]);
}
Console.WriteLine("\tCORRIENTE "+"\tRESISTENCIA " + "VOLTIOS");
for (I = 0; I < 10; I++)
{
Console.WriteLine("\t"+corriente[I] +" \t\t" + resistencia[I] +"\t\t " + voltios[I]);
}
Console.ReadLine();
}
}
}

Practica 8.2 c) Consola


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

namespace Practica_8._._2_C__Consola
{
class Program
{
static void Main(string[] args)
{
int[] emax = new int[10];
int i, menor, pos;
Console.WriteLine("Introdusca 10 numeros enteros");
emax[0] = int.Parse(Console.ReadLine());
menor = emax[0];
pos = 0;
for (i = 1; i <>
{
Console.WriteLine("Introduce dato {0}", i);
emax[i] = int.Parse(Console.ReadLine());
if (emax[i] <>
{
menor = emax[i];
pos = i;
}
}

Console.WriteLine("\nLista de 10 elementos");
for (i = 0; i <>
{
Console.WriteLine(emax[i]);
}
Console.WriteLine("\nEl valor minimo es={0}", menor);
Console.WriteLine("Este es el elemtento numero {0} en la lista de numeros", pos);
Console.ReadKey();
}
}
}

Practica 8.2 b) Consola


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

namespace Practica_8._2_B__Consola
{
class Program
{
static void Main(string[] args)
{
int[] emax = new int[10];
int i, mayor,pos;
Console.WriteLine("Introdusca 10 numeros enteros");
emax[0] = int.Parse(Console.ReadLine());
mayor = emax[0];
pos = 0;
for (i = 1; i <>
{
Console.WriteLine("Introduce dato {0}", i);
emax[i] = int.Parse(Console.ReadLine());
if (emax[i] > mayor)
{
mayor = emax[i];
pos=i;
}
}

Console.WriteLine("\nLista de 10 elementos");
for (i = 0; i <>
{
Console.WriteLine(emax[i]);
}
Console.WriteLine("El valor maximo es={0}", mayor);
Console.WriteLine("Este es el elemtento numero {0} en la lista de numeros",pos);
Console.ReadKey();
}
}
}

Practica 8.2 Consola


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

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

int[] emax = new int[10];
int i, mayor;
Console.WriteLine("Ïntrodusca 10 numeros enteros");
emax[0] = int.Parse(Console.ReadLine());
mayor = emax[0];
for (i = 1; i <>
{
Console.WriteLine("introduce dato{0};", i);
emax[i] = int.Parse(Console.ReadLine());
if (emax[i]>mayor)
{
mayor = emax[i];
}
}
Console.WriteLine("\n lista de 10 elementos");
for (i = 0; i <>
{
Console.WriteLine(emax[i]);
}
Console.WriteLine("el valor maximo es={0}", mayor);
Console.ReadKey();
}
}
}

Practica 8.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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
int[] temp;
int i, suma, p;

public Form1()
{
InitializeComponent();
temp = new int[8];
i = suma = p = 0;

}

private void button1_Click(object sender, EventArgs e)
{

if(i<8)
{
temp[i]=int.Parse(textBox1.Text);
suma=suma+temp[i];
listBox1.Items.Add(temp[i]);
textBox1.Clear();
textBox1.Focus();
i++;
}
else
{
textBox1.Clear();
textBox1.Enabled=false;
button1.Enabled=false;



}
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Add("");
p=suma/8;
listBox1.Items.Add("promedio="+p.ToString());
}
}
}

Practica 8.1 Consola

Pseudocodigo

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 VALOR ENTERO”);
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 (“LA SUMA DE LOS PARES ES”, SUMAPAR)
PRINT (“NUMEROS IMPARES :”)
FOT ( I=0; I

{
IF (VALORES [I] %2==1)
{
PRINT (VALORES [I]);
}}
PRINT ();
PRINT (“LA SUMA DE LOS NUMEROS IMPARES ES”, SUMIPAR);
FIN











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

namespace ConsoleApplication10
{
class Program
{
static void Main(string[] args)
{
int[] temp = new int[8];
int suma = 0, i, p;
Console.WriteLine("Ïntrodusca los siguientes elementos");
for (i = 0; i <>
{
Console.WriteLine("dato{0};", i);
temp[i] = int.Parse(Console.ReadLine());
suma += temp[i];
}
p = suma / 8;
Console.WriteLine("\n lista de 8 elementos");
for (i = 0; i <>
{
Console.WriteLine(temp[i]);
}
Console.WriteLine("promedio={0}", p);
Console.ReadKey();



}
}
}

lunes, 26 de octubre de 2009

Practica 7.5 Visual

PSEUDOCODIGO
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 < N; I++)
{
PRINT("Introduce valor entero ");
READ Valores[I]
if (valores[I] % 2 == 0)
{
sumapar += valores[I];
}
else
{
sumaimpar += valores[I];
}
}
PRINT("Numeros Pares ");
while (I < N)
{
if (valores[I] % 2 == 0)
{
PRINT("{0}", valores[I]);
}
}

PRINT("La suma de los numeros pares es {0}", sumapar);
PRINT("Numeros impares");
while (I < N)
{
if (valores[I] % 2 == 1)
{
PRINT("{0}", valores[I]);
}
}

CPRINT("La suma de numeros impares es {0}", sumaimpar);
if (sumapar > sumaimpar)
{
PRINT("La suma menor es:{0} ", sumaimpar);
}
else
{
PRINT("La suma menor es:{0}", sumapar);
}
FINAL






using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
int suma, n, num, suma1, num1, mayor, c, menor;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
n=int.Parse(textBox1.Text);
mayor=suma;
menor=suma1;

for (num =1; num<=n;num=num+2)
{
suma=suma+num;


}
for (num1 =2; num1<=n;num1=num1+2)
{
suma1=suma1+num1;
if (suma>mayor)
{
mayor=suma;
}
c=c+1;
}
textBox2.Text=(""+ suma.ToString());
textBox3.Text=(""+ suma1.ToString());
textBox4.Text=(""+ mayor.ToString());
}


private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}
}

Practica 7.3 Visual

PSEUDOCODIGO
FLOAT n, p, exp;

p = 1;

PRINT("introduce un numero");

READ n

while (p <= n)

{


exp = Math.Pow(p, p);



PRINT( p, p, exp);

p = p + 1;

}

FINAL










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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
double n, x, y;
public Form1()
{
x = 1;
n = y;
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
n = double.Parse(textBox1.Text);
listBox1.Items.Add("Numero Potencia Resultado");
for (x = 0; x <= n; x = x + 0)
{
y = 1 * Math.Pow(x, 1) + 1 * Math.Pow(x, 2) + 1 + x++;
listBox1.Items.Add(" " + x.ToString() + " " + x.ToString() + " " + y.ToString());
}
}


private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}
}

Practica 7.2 Visual

PSEUDOCODIGO
float n, I, x = 0.0;

PRINT("Introduzca un numero");
READ(n)

if (n < 2)
{
PRINT("Introduzca valores mayores que 2");
}

else if (n > 2)
{
for (I = 2; I <= n; I = I + 2)
{

PRINT(I)
x = x + I;
}

PRINT("La suma de los numeros pares es: {0}", x);
{

}
}
final









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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
double n, i, suma;
public Form1()
{
n= i;
suma = 0;
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
n = double.Parse(textBox1.Text);
if (n<2)
{
textBox2.Text=("El valor es incorrecto");
}
for (i=2; i<=n; i=i+2)
{
suma=suma+i;
}
textBox2.Text = ("" + suma.ToString());
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}
}

Practica 7.1 Visual



PSEUDOCODIGO

double x = 1.0, T;

int d;

for (d = 2; d <= 198; d = d + 2)

{

T = 1.0 / d;

Print(T);

x = x + T;

}

Print( La suma de la serie es: {0}", x);

Final








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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
double sumaserie, termino, valor;
int d;
public Form1()
{
termino = d;
sumaserie = 1.0;
valor = 1;
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("+" + valor.ToString());
for (d = 2; d <= 198; d = d + 2)
{
termino = 1.0 / d;
listBox1.Items.Add("+" + termino.ToString());
sumaserie = sumaserie + termino;
}
listBox1.Items.Add("=" + sumaserie.ToString());
}
}
}

miércoles, 21 de octubre de 2009

Practica 7.5 consola



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

namespace Practica_7_prob_5_C
{
class Program
{
static void Main(string[] args)
{
int N;
int[] valores;
Console.Write("Introduce Numero de valores:");
N = int.Parse(Console.ReadLine());
valores = new int[N];
int I;
int sumapar = 0;
int sumaimpar = 0;
for (I = 0; I < 2 ="="" 2 ="="" 2 ="=""> sumaimpar)
{
Console.WriteLine("\nLa suma menor es:\t{0} ", sumaimpar);
}
else
{
Console.WriteLine("\nLa suma menor es:\t{0}", sumapar);
}



Console.ReadKey();




}
}
}

martes, 20 de octubre de 2009

Practica 7.3 consola




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

namespace potencias
{
class Program
{
static void Main(string[] args)
{
double n, k, exp;
k = 1;
Console.WriteLine("\n\tintroduce un numero");
n = double.Parse(Console.ReadLine());
Console.WriteLine("\n\nPOTENCIA \t\tELEVADO A LA POTENCIA \t\t\tRESULTADO");
while (k <= n) { exp = Math.Pow(k, k); Console.Write("\n{0} \t\t\t{1} \t\t\t\t{2}", k, k, exp); k = k + 1; } Console.ReadLine(); } } }

Practica 7.4 consola

PSEUDOCODIGO
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 < N; I++)
{
PRINT("Introduce valor entero ");
READ Valores[I]
if (valores[I] % 2 == 0)
{
sumapar += valores[I];
}
else
{
sumaimpar += valores[I];
}
}
PRINT("Numeros Pares ");
for (I = 0; I < N; I++)
{
if (valores[I] % 2 == 0)
{
PRINT( valores[I]);
}
}
Console.WriteLine();
PRINT("La suma de los numeros pares es{0} ", sumapar);
PRINT("Numeros impares ");
for (I = 0; I < N; I++)
{
if (valores[I] % 2 == 1)
{
PRINT("{0} ", valores[I]);
}
}

PRINT("La suma de numeros impares es {0} ", sumaimpar);
if (sumapar > sumaimpar)
{
PRINT("La suma mayor es par:{0}", sumapar);
}
else
{
PRINT("\nLa suma mayor es impar:{0} ", sumaimpar);
}
FINAL







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

namespace problema_
{
class Program
{
static void Main(string[] args)
{
int REP, C = 1, NUMERO, SUMAPAR=0, SUMAIMPAR=0;
Console.WriteLine("introduce la cantidad de numeros que se ingresaran");
REP = int.Parse(Console.ReadLine());
while( C<=REP )
{Console.WriteLine("introduce un numero entero");
NUMERO = int.Parse(Console.ReadLine());
if (NUMERO % 2 == 0)
{
SUMAPAR = SUMAPAR + NUMERO;
}
if (NUMERO % 2 == 1)
{
SUMAIMPAR = SUMAIMPAR+ NUMERO;
}
C = C + 1;
}
Console.WriteLine("\nla suma de los numeros pares es:{0}", SUMAPAR);
Console.WriteLine("la suma de los numeros impares es:{0}", SUMAIMPAR);
if (SUMAPAR > SUMAIMPAR)
{
Console.WriteLine("\n La Suma de numeros pares es MAYOR que la\nsuma de los numeros impares");
}
else
{
Console.WriteLine("\n La Suma de numeros IMpares es MAYOR que la\nsuma de los numeros impares");
}
Console.ReadKey();
}
}
}

Practica 7.7 consola

PSEUDOCODIGO
double n, x = 0, valor = 0, suma = 0, prom = 0;
PRINT("Cuantos numeros quiere sumar");
READ n
for (x = 1; x <= n; x = x + 1)
{
PRINT("Introduce numero ", x);
READ valor

suma = suma + valor;

prom = suma / n;
}
PRINT("La suma es = " + suma + "El promedio es = " + prom);
FINAL










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

namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
double valoresN = 0.0, Suma, dmayor, contador, valor2;

Console.Write("Introduce la cantidad de valores a procesar ");
valoresN = double.Parse(Console.ReadLine());
Suma = 0.0;
dmayor = 0.0;
for (contador = 1; contador <= valoresN; contador = contador + 1)
{
Console.WriteLine("Introduce valor");
valor2 = double.Parse(Console.ReadLine());
Suma = Suma + valor2;
if (valor2 > dmayor)
{
dmayor = valor2;
}
}

Console.WriteLine("La suma de los valores es: {0} ", Suma);
Console.WriteLine("El promedio es : {0} ", Suma / valoresN);
Console.ReadKey();
}
}
}

Practica 7.8 consola

PSEUDOCODIGO
int n, p = 1, c;
PRINT("Introduzca un numero entero");
READ n
for (c = 1; c <= n; c = c + 2)
{
p = p * c;
}
PRINT"El producto de los numeros impares al valor leido es: {0}", p);
FINAL







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

namespace EXAMEN_UNIDAD2_CONSOLA
{
class Program
{
static void Main(string[] args)
{
int C,N,P=1;
Console.WriteLine("introduce el valor ");
N = int.Parse(Console.ReadLine());
Console.WriteLine("el producto de los numeros impares es:");
for (C = 1; C<=N; C = C + 2)
{
P=P*C;
}
Console.WriteLine("{0} ",P );
Console.ReadKey();
}
}
}

Practica 7.6 consola

PSEUDOCODIGO
double n, valor, mayor=0, menor=0, c = 1,x;
PRINT("Cantidad de numeros");
READ n
PRINT(" introduce un valor entero");
READ valor
mayor = valor;
menor = valor;
c = 1;
while (c < n)
{
PRINT("introduce un valor entero");
READvalor
if (valor > mayor)
{
do
{


PRINT( mayor);
x = x + mayor;
}while(mayor = 2; mayor <= n; mayor = mayor + 2);

mayor = valor;

}
if (valor < menor)
{
menor = valor;
}
c = c + 1;
}
PRINT("el numero mayor es:{0}", mayor);
PRINT("el numero menor es:{0}", menor);
FINAL









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

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int n, valor, mayor, menor, c = 1;
Console.WriteLine("introduce cantidad de numeros");
n = int.Parse(Console.ReadLine());
Console.WriteLine("introduce un valor entero");
valor = int.Parse(Console.ReadLine());
mayor = valor;
menor = valor;
c = 1;
while (c < valor =" int.Parse(Console.ReadLine());">mayor)
{
mayor = valor;
}

if (valor < mayor)

menor = valor;

c = c + 1;
}
Console.WriteLine("El dato mayor es: {0}",mayor);
Console.WriteLine("El dato menor es: {0}",menor);
Console.ReadKey();

}

}
}

Practica 7.2 consola


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

namespace pract7._2
{
class Program
{
static void Main(string[] args)
{
Double n, i, suma = 0;
Console.WriteLine("\n\n\t\tINTRODUCE UN NUMERO PAR ");
n = double.Parse(Console.ReadLine());
if (n <>
{
Console.WriteLine("\n\n\t\t EL NUMERO ES INCORRECTO ");
}

for (i = 2; i <= n; i = i + 2)
{
suma = suma + i;
}
Console.WriteLine("\n\n\n\t\tLA SUMA DE LOS NUMEROS PARES ES: {0} ", suma);
Console.ReadLine();
}
}
}

Practica 7.1 consola


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

namespace examen4C
{
class Program
{
static void Main(string[] args)
{
double ss = 1.0, T, D;

for (D = 1; D <= 199; D = D + 2)
{
T = 1 / D;
Console.WriteLine(T);
ss = ss + T;
}
Console.WriteLine ("\nLa suma es = {0}", ss);
Console.ReadKey();
}
}
}

domingo, 18 de octubre de 2009

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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
label2 = double.Parse(textBox1.Text);
label3 = double.Parse(textBox2.Text);
label4 = double.Parse(textBox3.Text);
listBox1.Items.Add("Celsius Fahrenheit");
valorI = label2;
while (valorI <= label3)
{
Fah = (9.0 / 5.0) * valorI + 32;
listBox1.Items.Add(valorI.ToString() + "\t = " + Fah.ToString());
valorI = valorI + label4;
}
}

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


}

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

domingo, 11 de octubre de 2009

Practica 6.6 Visual


Pseudocodigo







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_2_Windows
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double A, I, C, T;
A = 2010 - 1624;
I = 24 * 0.05;
C = 24.0 + I;
T = C * A;
label1.Text = "El saldo al 31 de diciembre de 2010 es ";

label1.Text = label1.Text + T.ToString() + "\nDonde 24 es la cantidadcalculada por el programa.";

}

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

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

Practica 6.6 Consola

[practica7.2.jpg]

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

namespace Practica_7_2_Consola
{
class Program
{
static void Main(string[] args)
{
double A, I, C, T;
A= 2010 - 1624;
I = 24 * 0.05;
C = 24.0 + I;
T = C * A;
Console.WriteLine("El saldo al 31 de diciembre de 2010 es\t{0}",T);
Console.WriteLine("Donde 24 es la cantidad calculada por el programa");
Console.ReadKey();

}
}
}

Practica 6.5 Visual


Pseudocodigo



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_Windows
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double F, u, lergios, ergios;
F = double.Parse(f.Text);

u = double.Parse(U.Text);
lergios = 2 * 3.1416 * Math.Exp(u);
ergios = F * Math.Sqrt(lergios);
E.Text = (ergios.ToString());

}

private void button2_Click(object sender, EventArgs e)
{
f.Clear();
U.Clear();
E.Clear();
}

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

Practica 6.5 Consola


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

namespace Practica_7_1_Consola
{
class Program
{
static void Main(string[] args)
{
double f, U, lergios, ergios;
Console.WriteLine("Introduce valor de fergios");
f = double.Parse(Console.ReadLine());
Console.WriteLine("Introduce valor de U");
U = double.Parse(Console.ReadLine());
lergios = 2 * 3.1416 * Math.Exp(U);
ergios = f * Math.Sqrt(lergios);
Console.WriteLine("Ergios=\t{0}", ergios);
Console.ReadKey();

}
}
}

Practica 6.4 Visual

Pseudocodigo



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_6_4_Windows
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double P, T;
double A= 1994;

listBox1.Items.Add("\nAño \t\t Poblacion\n");
for (T = 9; T <= 25; T = T + 1.0) { P = 4.88 * (1 + Math.Exp(0.02 * T)); listBox1.Items.Add(A.ToString() + "\t\t" + P.ToString()); A++; } } private void button2_Click(object sender, EventArgs e) { listBox1.Items.Clear(); } private void button3_Click(object sender, EventArgs e) { Close(); } } }

Practica 6.4 Consola


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

namespace Practica_6_4_Consola
{
class Program
{
static void Main(string[] args)
{
double P, T;
double A = 1994;

Console.WriteLine("\t Poblacion Mundial en miles de millones de personas");
Console.WriteLine("\nAño \t\t Poblacion\n");
for (T = 9; T <= 25; T = T + 1.0) { P = 4.88 * (1 + Math.Exp(0.02 * T)); Console.WriteLine("{0}\t\t\t{1}\n", A, P); A++; } Console.ReadKey(); } } }

Practica 6.3 Visual c)

Pseudocodigo


[practica6.3cw.jpg]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_6_3_c__Windows
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double t, y;

listBox1.Items.Add(" Valor de T \t\t Valor de Y");

for (t = 2; t <= 10; t = t + 0.5) { y = 2 * Math.Exp(0.8 * t); listBox1.Items.Add(t.ToString() + "\t\t\t" + y.ToString()); } } private void button2_Click(object sender, EventArgs e) { listBox1.Items.Clear(); } private void button3_Click(object sender, EventArgs e) { Close(); } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { } } }

Practica 6.3 Consola c)


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

namespace Practica_6_3_c__Consola
{
class Program
{
static void Main(string[] args)
{
double t, y;
Console.WriteLine("Funcion Matematica");
Console.WriteLine("\n\nValor de X Valor de Y");
for (t = 2; t <= 10; t = t + 0.5) { y = 2 * Math.Exp(0.8 * t); Console.WriteLine("{0}\t\t{1}", t, y); } Console.ReadKey(); } } }

Practica 6.3 Visual b)

Pseudocodigo



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

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
double x, y;

listBox1.Items.Add(" Valor de X \t\t Valor de Y");

for (x = 1; x <= 5; x = x + 0.1)
{
y = 1 + x + Math.Pow(x, 3) / 6.0 + Math.Pow(x, 4) / 24.0;
listBox1.Items.Add(x.ToString() + "\t\t\t" + y.ToString());
}
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}

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


}
}

Practica 6.3 b) Consola


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

namespace Practica_6_3_b__Consola
{
class Program
{
static void Main(string[] args)
{
double x, y;
Console.WriteLine("Funcion Matematica");
Console.WriteLine("\n\nValor de X Valor de Y");
for (x = 1; x <= 5; x = x + 0.1) { y = 1 + x + Math.Pow(x, 3) / 6.0 + Math.Pow(x, 4) / 24.0; Console.WriteLine("{0}\t\t{1}", x, y); } Console.ReadKey(); } } }

Practica 6.3 Visual


Pseudocodigo

[practica6.3w.jpg]

System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Practica_6_3_Windows
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double x, y;

listBox1.Items.Add(" Valor de X \t\t Valor de Y");

for (x = 2; x <= 10; x = x + 0.2) { y = 2 * Math.Pow(x, 5) + 2 * Math.Pow(x, 3) + x; listBox1.Items.Add(x.ToString() + "\t\t\t" + y.ToString()); } } private void button2_Click(object sender, EventArgs e) { listBox1.Items.Clear(); } private void button3_Click(object sender, EventArgs e) { Close(); } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { } } }

Practica 6.3 Consola



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

namespace Practica_6_3_Consola
{
class Program
{
static void Main(string[] args)
{
double x, y;
Console.WriteLine("Funcion Matematica ");
Console.WriteLine("\n\nValor de X Valor de Y");
for (x = 2; x <= 10; x = x + 0.2)
{
y = 2 * Math.Pow(x, 5) + 2 * Math.Pow(x, 3) + x;


Console.WriteLine("{0}\t\t{1}", x, y);
}
Console.ReadKey();

}
}
}

Practica 6.2 Visual


Pseudocodigo


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_6._2_Windows
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double n, I, S = 0.0;

n = double.Parse(N.Text);
label2.Text = "La suma de sus numeros Impares es: ";
for (I = 1; I <= n; I = I + 2)
{
S = S + I;
}
label2.Text = label2.Text + S.ToString();



}

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

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

Practica 6.2 Consola



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

namespace Practica_6._2_consola
{
class Program
{
static void Main(string[] args)
{
double N, I, S = 0.0;
Console.WriteLine("Introduce un numero:");
N = double.Parse(Console.ReadLine());

for (I = 1; I <= N; I = I + 2)
{
S = S+I ;
}

Console.WriteLine("La suma de los numero impares es {0}", S);

Console.ReadKey();
}
}
}

Practica 6.1 Visual


Pseudocodigo


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

private void button1_Click(object sender, EventArgs e)
{
double n, factor = 1.0, I;
n = double.Parse(N.Text);
label2.Text = "Su factorial es: ";

for (I = n; I >= 1; I--)
{
factor = factor * I;

}
label2.Text = label2.Text + factor.ToString();

}

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

}

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

Practica 6.1 Consola



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

namespace Practica_6_1_Consola
{
class Program
{
static void Main(string[] args)
{
double N, Factor = 1.0, I;
Console.WriteLine("Introduce un numero para calcular factorial");
N = double.Parse(Console.ReadLine());
for (I = N; I >= 1; I--)
{
Factor = Factor * I;
}
Console.WriteLine("El factorial es: {0}", Factor);
Console.ReadKey();
}
}
}

Practica 5.3 Visual d)


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_5_3_d__Windows
{
public partial class Form1 : Form
{
int C1 = 0;
int cont = 0;
public Form1()
{


InitializeComponent();


}

private void button1_Click(object sender, EventArgs e)
{

C1 = int.Parse(C.Text);
if (cont == 5 || C1 == 999)
{
Close();
}

if ((C1 <> 100))
{
cont++;
label1.Text = ("Calificacion Invalida");

}
else
{
label1.Text = (" ");
listBox1.Items.Add(C1);
}


}

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

}

private void button2_Click(object sender, EventArgs e)
{
C.Clear();
listBox1.Items.Clear();

}


}
}

Practica 5.3 Consola d)


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

namespace Practica_5_3_d__Consola
{
class Program
{
static void Main(string[] args)
{
int C1 = 0, cont = 0;

do
{
Console.WriteLine("\nIntroduce calificacion");
C1 = int.Parse(Console.ReadLine());
Console.WriteLine("Calificacion : {0}", C1);
if (C1 <> 100)
{
Console.WriteLine("Calificacion invalida");
cont++;
}


}
while (cont <>

}
}
}