Programacion

Páginas: 9 (2095 palabras) Publicado: 12 de septiembre de 2011
PROGRAMACIÓN I
NOMBRE: JUAN CARLOS TIGRE CHUQUI
EJERCICIOS REALIZADOS EN CLASE

* Ejercicio en clase: una parte de un cuadrado
privatevoid button1_Click(object sender, EventArgs e)
{
PenmyPen = newPen(Color.Pink);
this.CreateGraphics().DrawLine(myPen, 100,200,100,100);
this.CreateGraphics().DrawLine(myPen, 100, 200, 200, 200);
}
Segunda parte del cuadrado
privatevoidbutton1_Click(object sender, EventArgs e)
{
PenmyPen = newPen(Color.Green);
this.CreateGraphics().DrawLine(myPen, 270, 320, 450, 320);
this.CreateGraphics().DrawLine(myPen, 450, 320, 450, 450);
}

* Estrella con inicial dentro de ella
privatevoid button1_Click(object sender, EventArgs e)
{
L
Penmypen = newPen(Color.Blue);
this.CreateGraphics().DrawLine(mypen, 300,200, 250, 300);
this.CreateGraphics().DrawLine(mypen, 300, 200, 350, 300);
this.CreateGraphics().DrawLine(mypen, 150, 300, 250, 300);
this.CreateGraphics().DrawLine(mypen, 350, 300, 450, 300);
this.CreateGraphics().DrawLine(mypen, 230, 380, 150, 300);
this.CreateGraphics().DrawLine(mypen, 450, 300, 380, 380);
this.CreateGraphics().DrawLine(mypen, 230, 380, 155, 500);this.CreateGraphics().DrawLine(mypen, 380, 380, 455, 500);
this.CreateGraphics().DrawLine(mypen, 155, 500, 300, 425);
this.CreateGraphics().DrawLine(mypen, 455, 500, 300, 425);

//inicial
this.CreateGraphics().DrawLine(mypen, 270, 320, 270, 400);
this.CreateGraphics().DrawLine(mypen, 270, 400, 340, 400);
}


edad 1 | edad 2 | >18 | mensaje |
10 | 20 | x | Edad1es menor de edad |
10 | 20 | √ | 40 |
SEGUNDA CORRIDA |
edad 1 | edad 2 | >18 | mensaje |
19 | 21 | √ | Edad1 es mayor de edad |
19 | 21 | √ | 41 |
* Ejercicio en clase: Calcular la edad
public Form1()
{
int edad1 = 10;
int edad2 = 20;
if (edad1>18)
{
MessageBox.Show("edad1 es mayor de edad");
}
else
{MessageBox.Show("edad1 es menor de edad");
}
if (edad2 >18)
{
edad2=edad2 + 20;
MessageBox.Show(edad2.ToString());
}
}
privatevoid button1_Click(object sender, EventArgs e)
{

* Ejercicio en clase: 0,1,1,2,3,5,7 (calcular números)

int a = 0;
a | b | c | Num_elem | pantalla |
0 | 1 | 0 |5 | 0 |
1 | 0 | 1 | 4 | 1 |
0 | 1 | 1 | 3 | 1 |
1 | 1 | 2 | 2 | 2 |
1 | 2 | 5 | 1 | 3 |
1 | 3 | 5 | 0 | |
SEGUNDA CORRIDA |
2 | 3 | 5 | 5 | 5 |
3 | 5 | 8 | 4 | 8 |
5 | 8 | 13 | 3 | 13 |
8 | 13 | 21 | 2 | 21 |
13 | 21 | 34 | 1 | 34 |
21 | 34 | 55 | 0 | |
int b = 1;
int c = 0;
intnum_elem = 0;Console.WriteLine("Ingrese la cantidad de numeros");
num_elem=Convert.ToInt16(Console.ReadLine());

while (num_elem>=0)
{
Console.WriteLine (c);
a=b;
b=c;
c=a+b;
num_elem= num_elem - 1;
}
Console.ReadKey();



* Ejercicio en clase: Serie que parte del 10 hasta el 1
i | 1 | PANTALLA | | i | 1 | PANTALLA|
10 | / | 10 | | 13 | / | 13 |
9 | / | 9 | | 12 | / | 12 |
8 | / | 8 | | 11 | / | 11 |
7 | / | 7 | | 10 | / | 10 |
6 | / | 6 | | 9 | / | 9 |
5 | / | 5 | | 8 | / | 8 |
4 | / | 4 | | 7 | / | 7 |
3 | / | 3 | | 6 | / | 6 |
2 | / | 2 | | 5 | / | 5 |
1 | / | 1 | | 4 | / | 4 |
| | | | 3 | / |3 |
| | | | 2 | / | 2 |
| | | | 1 | / | 1 |
for (int i=10; i>=1; i=i-1)
{
Console.WriteLine(i);
}
Console.ReadKey();

}










* Ejercicio en clase cuadrado con 20 caracteres
int tam = 20;
for (int lv = 1; lv <= tam; lv++)
{
if (lv == 1 || lv == tam)
for (intlh = 1; lh<= tam;...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Programación
  • Programacion
  • Programacion
  • Programación
  • Programacion
  • Programacion
  • Programacion
  • Programacion

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS