20091103

PRACTICA 9.1 CALIFICACIONES Y PROMEDIOS(consola)

pseudocodigo.
inicio
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 to I < promedio =" suma" i =" 0" i =" 0" suma =" 0" i =" 0" suma =" suma" varianza =" suma" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuaT_zJ_py_SYcSXGw6OjYqrCCl3H0Fp0raSZMNarUBDe8NeF6A_rlSD7r_pYkoxKF_s07dY2KbnyXfo1228WFPCviqE1FouY_WqADnjFsWvSEUei-y0KrmzVAfB6QfzJaW0U4N3qj4NAf/s1600-h/9.0.bmp">

















Ejecutable del programa y calificaciones.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 < suma =" suma)
}
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();
}
}
}



20091030

PRACTICA 7.6 NUMERO MAYOR, NUMERO MENOR.(consola ,visual)

pseudocodigo.
inicio
int n, valor, M, m, c = 1

print "INTRODUCE LA CANTIDAD DE NUMEROS"
Read n
print "INTRODUCE UN VALOR ENTERo"
Read valor
M=valor; m=valor; c=1
while(M>m)
{
M=valor;
} if(valor>M)
{
m=valor;
}
c = c + 1
}
print("EL DATO MAYOR ES ,M)
print("EL DATO MENOR ES ",m
}fin






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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n, valor, M, m, c = 1;
Console.WriteLine("INTRODUCE LA CANTIDAD DE NUMEROS");
n = int.Parse(Console.ReadLine());
Console.WriteLine("INTRODUCE UN VALOR ENTERO__");
valor = int.Parse(Console.ReadLine());
M=valor;
m=valor;
c=1;
while(M>m)
{
M=valor;
}
if(valor>M) {
m=valor;
}
c = c + 1;
}
Console.WriteLine("EL DATO MAYOR ES:{0}",mayor);
Console.WriteLine("EL DATO MENOR ES:{0}",menor);
Console.ReadKey();
}
}
}





NUMERO MAYOR, NUMERO MENOR.(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

int N, valor, may, men, c = 1;

public Form1()

{InitializeComponent();

}private void button1_Click(object sender, EventArgs e)

{

N = int.Parse(textBox1.Text);

valor=int.Parse(textBox2.Text);

textBox2.Focus();

textBox2.Clear();

if (c <= N)

{listBox1.Items.Add(valor);

if (valor > may)

{may = valor;

}

if (valor <>

{men = valor;

}

c = c + 1;}

else{textBox2.Clear();

textBox2.Enabled = false;

button1.Enabled = false;

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

{label3.Text = "El dato mayor es:" + may.ToString();label4.Text = "El dato menor es:" + men.ToString();

}


PRACTICA 7.4 SUMA DE PARES Y SUMA MAYOR IMPAR

pseudocodigo.
int N
int[] valores
print "Introduce numero de elementos "
Read Nvalores = new int[N]
int I
int sumapar = 0
int sumaimpar = 0
for (I = 0 to I step I++)
{
print "Introduce valor entero "
Read Valores[I] if (valores[I] % 2 == 0)
{
sumapar += valores[I]
}
else
{
sumaimpar += valores[I];
}}
print(" ");
for (I = 0;I
{
if (valores[I] % 2 == 0)
{
print( valores[I])
}}
print"{0} ", sumapar

print "Numeros impares "
for (I = 0; I {
if (valores[I] % 2 == 1)
{
print "{0} ", valores[I]

}}
print" {0} ", sumaimpar
if (sumapar > sumaimpar)
{
print":{0}", sumapar)
}
else
{
print":{0} ", sumaimpar
}final















A continuacion el ejecutable o programa para este ejercicio.

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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int N;
int[] valores;
Console.Write("INTRODUCE NUMEROS DE ELEMENTOS \n ");
N = int.Parse(Console.ReadLine());
valores = new int[N];
int I;
int sumapar = 0;
int sumaimpar = 0;
for (I = 0; I {
Console.Write("MUNERO ENTERO__");
valores[I] = int.Parse(Console.ReadLine());
if (valores[I] % 2 == 0)
{
sumapar = valores[I];
}
else
{

{sumaimpar += valores[I];
}}
Console.WriteLine("Numeros Pares ");
for (I = 0; I <>
{
if (valores[I] % 2 == 0)
{
Console.WriteLine("valores{0} ", valores[I]);
}}
Console.WriteLine();
Console.WriteLine("\n\nLa suma de los numeros pares es{0} ", sumapar);
Console.WriteLine("Numeros impares ");
for (I = 0; I < 2 ="=">
{
Console.Write("{0} ", valores[I]);
}}
Console.WriteLine();
Console.WriteLine("\n\nLa suma de numeros impares es {0} ", sumaimpar);
if (sumapar > sumaimpar)
{Console.WriteLine("\nLa suma mayor es par:{0} ", sumapar);
}
else
{Console.WriteLine("\nLa suma mayor es impar:{0} ", sumaimpar);
}Console.ReadKey();


SUMA DE PARES Y SUMA DE MAYORE IMPAR.







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
{
private void button1_Click(object sender, EventArgs e)

{

int n, suma, num, num1, mayor=0, menor=0;

double suma1;suma = 0;suma1 = 0;

double c=0 ;

n = int.Parse(textBox1.Text);

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

{ suma = suma + num;

}

for (num1 = 2; num1 <= n; num1 = num1 + 2)

{ suma1 =suma1 + num1;

} c = c + 1;if (suma <>

{textBox2.Text = (suma.ToString());textBox3.Text = (suma1.ToString());textBox4.Text = (suma1.ToString());

for (c = 2; c <= n; c = c + 2)

{

listBox1.Items.Add(c);

}}

else{textBox2.Text = (suma.ToString());textBox3.Text = (suma1.ToString());textBox4.Text = (suma.ToString());

for (c = 1; c <= n; c = c + 2)

{listBox1.Items.Add(c);

}}}

private void button2_Click(object sender, EventArgs e)

{textBox2.Text="";textBox3.Text = "";textBox4.Text = "".

}

}}

20091021

PRACTICA 7.8 PRODUCTO DE ENTEROS IMPARES

pseudocodigo.
inicio
int n, S = 1, c
print "INTRODUZCA UN NUMERO ENTERO"
Read n
for (c = 1 to c <= n step c = c + 2)
{
S= S* c
print "EL PRODUCTO DE LOS NUMEROS IMPARES ES: S
} fin









Escriba un programa que calcule e imprima el producto de los enteros impares del 1 al N. dar por el teclado el valor N.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n, S = 1, c;
Console.WriteLine("INTRODUZCA UN NUMERO ENTERO");
n = int.Parse(Console.ReadLine());
for (c = 1; c <= n; c = c + 2) { S= S* c; } Console.WriteLine("\nEL PRODUCTO DE LOS NUMEROS IMPARES ES: {0}", S); Console.ReadKey(); } } } PRODUCTO DE ENTEROS IMPARES (visual)








A continuacion el programa ejecutable , esperando y no sea erroneo,. se me precentaron algunos problemas ,. no es nada complejo ,.pero aqui esta..


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int n, c,p=1;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Console.WriteLine("Introduzca un numero entero");
n = int.Parse(textBox1.Text);
for (c = 1; c <= n; c = c + 2)

{

p = p * c; } textBox2.Text = ("El producto de los numeros impares es=" + p.ToString());

} private void button2_Click(object sender, EventArgs e)

{ textBox1.Clear();

textBox2.Clear();

} private void button3_Click(object sender, EventArgs e)

{ Close(); } } }

PRACTICA 7.7 TOTAL PROMEDIO DE NUMEROS N.

pseudocodigo.
inicio.
int I
int N, NUMERO
double P = 0.0
double promedio

print "Introduce Numeros "
Read N
for I = 1 to I++
{
print " NUMERO ", I Read NUMERO P = P +NUMERO
} promedio = P / N;
print "promedio", promedio
} fin.





Diseñe un programa que lea un valor N, luego lea N números de entrada (utilice la instrucción for ) e imprima el total, promedio.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int I;
int N, NUMERO;
double P = 0.0;
double promedio;
Console.WriteLine("\n\tIntroduce Numeros ");
N = int.Parse(Console.ReadLine());
for (I = 1; I <= N; I++)

{

Console.Write("\n\t NUMERO {0}: ", I);
NUMERO = int.Parse(Console.ReadLine());
P = P +NUMERO;
}
promedio = P / N;
Console.WriteLine("\n\tpromedio={0}", promedio);
Console.ReadKey();
} }
}


PRACTICA 7.3 TABLA DE POTENCIAS DE 1 HASTA N,. NUMEROS.

pseudocodigo.
inicio
double n, p, exp; p = 1

print"INTRODUCE NUMERO"
Read n
print "potencia \t elevado a la potencia\tresultado"
while (p <= n) { exp = Math.Pow(p, p)
print "/ ", p, p, exp
p = p + 1
} fin.






Elaborar un programa que permita leer un número e imprima una tabla con las potencias de los números del 1 hasta el número leído. La potencia de 1 es 1 elevado a la potencia 1. La potencia de 2 es 2 elevado a la potencia de 2, y así sucesivamente hasta la potencia del número leído.






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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
{
double n, p, exp;
p = 1;
Console.WriteLine("INTRODUCE NUMERO");
n = double.Parse(Console.ReadLine());
Console.WriteLine("\n\npotencia \televado a la potencia\tresultado");
while (p <= n)


{

exp = Math.Pow(p, p); Console.Write("\n{0} \t\t\t{1}\t\t\t\t{2}", p, p, exp);

p = p + 1;

}

Console.ReadLine(); } } }







TABLA DE POTENCIAS DE A HASTA N, NUMEROS (visual)






A continuacion el ejecutable en vsisual.


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, p, exp;
p = 1;
n = int.Parse(textBox1.Text);
listBox1.Items.Add("potencia / elevado a la potencia / tresultado");
while (p <= n) { exp = Math.Pow(p, p); listBox1.Items.Add("" + p.ToString() + " " + p.ToString() + " " + exp.ToString()); p = p + 1; } } private void button2_Click(object sender, EventArgs e) { listBox1.Items.Clear(); textBox1.Clear(); } private void button3_Click(object sender, EventArgs e) { Close(); } private void textBox1_TextChanged(object sender, EventArgs e) { } } }

PRACTICA 7.2 CALCULO Y SUMA DE NUMEROS PAR DE 2 HASTA N, NUMEROS.

pseudocodigo.
inicio
double N, I, x = 0.0

print "Introduzca N numero"
Read N
if (N <0 to 2) step N++
else if (N > 2)
{
for (I = 2 to I <= N) step I = I + 2
{
print("\", I)
x = x + I;
}

print "La suma de los numeros pares es ", x
{

fin.










Diseñe un programa que le permita leer un numero N par, y calcule e imprima la suma de los números pares del 2 hasta el numero leído, si el numero leído es menor que 2, debe imprimir un mensaje de error.




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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double N, I, x = 0.0;

Console.WriteLine("Introduzca N numero");
N = double.Parse(Console.ReadLine());

if (N<0;n=0;n++)>

}

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

{

Console.Write("\n{0}", I);

x = x + I;
}

Console.WriteLine("\n\nLa suma de los numeros pares es {0}", x);
{
}
}
Console.ReadKey();
} } }