sábado, 24 de octubre de 2009

PRACTICA 6 PROBLEMA 4

namespace practica_6._4_console
{
class Program
{
static void Main(string[] args)
{
double x, y;
Console.WriteLine("\t\tfuncion matematica");
Console.WriteLine("\nvalor de x t\t\tvalor de y");
for (x = 1; x <= 5; x = x + 0.1)
{
y = 1.0 + x + Math.Pow(x, 2) / 2.0 + Math.Pow(x, 3) / 6.0 + Math.Pow(x, 4)/24.0;
Console.WriteLine("{0} \t\t\t{1} ", x, y);
}
Console.ReadLine();


PRACTICA EN WINDOWS


namespace PRACTICA_6._4_WINDOWS
{
public partial class Form1 : Form
{
double x, y;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double x, y;
listBox1.Items.Add("VALOR DE X \tVALOR DE Y");
for (x = 1; x <= 5; x = x + 0.1)
{
y = 1 + x + Math.Pow(x, 2) / 2.0 + Math.Pow(x, 3) / 6.0 + Math.Pow(x, 4) / 24.0;
listBox1.Items.Add(x.ToString() + "\t\t" + y.ToString());
}
}
private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}

practica 6 problema 3




namespace practica_6._3_cosnsole
{
class Program
{
static void Main(string[] args)
{
double x, y;
Console.WriteLine("\t\tfuncion matematica");
Console.WriteLine("\nvalor de x \t\tvalor de y");
for (x = 1; x <= 10; x = x + 0.2) { y = 3 * Math.Pow(x, 5) + 2 * Math.Pow(x, 3) + x; Console.WriteLine("{0} \t\t\t{1} ", x, y); } Console.ReadLine();




practica en windows


public partial class Form1 : Form
{
double x, y;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double x, y;
listBox1.Items.Add("VALOR DE X \t\tVALOR DE Y");
for (x = 2; x <= 10; x = x + 0.2)
{
y = 3 * Math.Pow(x, 5) + 2 * Math.Pow(x, 3) + x;
listBox1.Items.Add(x.ToString()+ "\t\t" + y.ToString());
}
}
}

PRACTICA 6 PROBLEMA 2




namespace PRACTICA_6._2_CONSOLE
{
class Program
{
static void Main(string[] args)
{
double n, i, suma = 0;
Console.WriteLine("\n\nINTRODUCE UN NUMERO");
n = double.Parse(Console.ReadLine());
for (i = 1; i <= n; i = i + 2) { suma = suma + i; } Console.WriteLine("\n\nLA SUMA DE LOS IMPARES ES: {0} ", suma); Console.ReadLine();




PRACTICA EN WINDOWS



namespace PRACTICA_6._2_WINDOWS
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double n, i, suma = 0;
n = double.Parse(textBox1.Text);
for (i = 1; i <= n; i = i + 2) { suma = suma + i; } textBox2.Text = suma.ToString(); } private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); } private void button3_Click(object sender, EventArgs e) { Close(); }

PRACTICA 6 PROBLEMA 1




namespace practica_6._1_consola
{
class Program
{
static void Main(string[] args)
{
double n, i, factor = 1.0;
Console.WriteLine("\n\nINTRODUCE EL VALOR DEL FACTORIAL");
n = double.Parse(Console.ReadLine());
for (i = n; i >= 1; i--)
{
factor = factor * i;
}
Console.WriteLine("\n\nEL FACTORIAL ES: {0}", factor);
Console.ReadLine();

PRACTICA EN WINDOWS


namespace practica_6._1_windows
{
public partial class Form1 : Form
{
double factor, n, i;
public Form1()
{
factor = 1.0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double n, i, factor = 1.0;
n = int.Parse(textBox1.Text);
for (i =n; i >= 1; i--)
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();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void Form1_Load(object sender, EventArgs e)

PRACTICA 5.4



{
class Program
{
static void Main(string[] args)
{
double t, rad, x, y;
t = 0;
rad = Math.PI * 22.8 / 180;
Console.WriteLine("\ntiempo \tvalor de x \t\tvalor de y");
while(t<10)
{
x = 500 * t * Math.Cos(rad);
y = 500 * t * Math.Sin(rad);
Console.WriteLine("{0} \t{1} \t{2} ", t, x, y);
t = t + 0.5;
}
Console.ReadLine();



PRACTICA EN WINDOWS

namespace practica_5._8_windows
{
public partial class Form1 : Form
{
double T, RAD, X, Y;
public Form1()
{
T = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double T, RAD, X, Y;
T = 0;
RAD = Math.PI * 22.8 / 180;
listBox1.Items.Add("TIEMPO \tVALOR DE X \t\tVALOR DE Y");
do
{
X = 500 * T * Math.Cos(RAD);
Y = 500 * T * Math.Sin(RAD);
listBox1.Items.Add(T.ToString() + "\t" + X.ToString() + "\t\t" + Y.ToString());
T=T+ 1.0/2.0;
}
while(T<=10); } 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 5 PROBLEMA 3




class Program
{
static void Main(string[] args)
{
int num, anum, dig;
Console.WriteLine("\n\nintroduce un valor entero");
num = int.Parse(Console.ReadLine());
anum = num;
do
{
dig = anum % 10;
Console.WriteLine("\ndigito {0}", dig);
anum = anum / 10;
}
while (anum != 0);
Console.ReadLine();
}
}


PRACTICA EN WINDOWS


namespace practica_5._7_windows
{
public partial class Form1 : Form
{
int num, anum, dig;
public Form1()
{
num= anum= dig=0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int num, anum, dig;
num = int.Parse(textBox1.Text);
anum = num;
do
{
dig = anum % 10;
listBox1.Items.Add("digito\t " + dig.ToString());
anum = anum / 10;
}
while (anum != 0);
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
listBox1.Items.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}

PRACTICA 5.2 D



namespace practica_5._6_console
{
class Program
{
static void Main(string[] args)
{
int c1, er;
c1 = 0;
er = 0;
do
{
Console.WriteLine(" \n Introduce Calificacion");
c1 = int.Parse(Console.ReadLine());
if (c1 <> 100)
{
er = er + 1;
}
}
while (er < 5);
Console.ReadLine();
}


PRACTICA EN WINDOWS



public partial class Form1 : Form
{
int c1, er;
public Form1()
{
c1 = 0;
er = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
c1 = int.Parse(textBox1.Text);
if (c1 <> 100)
{
listBox1.Items.Add(c1.ToString());
er = er + 1;
}
else
{
listBox1.Items.Add(c1);
}
if (er > 5)
{ Close(); }



PRACTICA 5.2 C




class Program
{
static void Main(string[] args)
{
int cl;
do
{
Console.WriteLine("introduce calificacion");
cl = int.Parse(Console.ReadLine());
Console.WriteLine("la calificacion:{0}", cl);
if (cl <> 100)
Console.WriteLine("calificacion incorrecta");
}
while (cl != 999);
Console.Read();


PRACTICA EN WINDOWS




namespace practica_5._5_windows
{
public partial class Form1 : Form
{
int c1, codigo = 999;
public Form1()
{
c1 = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
c1 = int.Parse(textBox1.Text);
if (c1 == codigo)
Close();
if (c1 <> 100)
{
textBox1.Enabled = false;
listBox1.Items.Add("Calificacion Incorrecta");
}
else
{
listBox1.Items.Add(c1);
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Enabled = true;
textBox1.Clear();
listBox1.Items.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();

PRACTICA 5.2 B



class Program
{
static void Main(string[] args)
{
int cl;
do
{
Console.WriteLine("introduce calificacion");
cl = int.Parse(Console.ReadLine());
Console.WriteLine("la calificacion:{0}", cl);
if (cl <> 100)
Console.WriteLine("calificacion incorrecta");
}
while (cl != 999);
Console.Read();
}

PRACTICA EN WINDOWS


namespace practica_5._5_windows
{
public partial class Form1 : Form
{
int c1, codigo = 999;
public Form1()
{
c1 = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
c1 = int.Parse(textBox1.Text);
if (c1 == codigo)
Close();
if (c1 <> 100)
{
textBox1.Enabled = false;
listBox1.Items.Add("Calificacion Incorrecta");
}
else
{
listBox1.Items.Add(c1);
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Enabled = true;
textBox1.Clear();
listBox1.Items.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void Form1_Load(object sender, EventArgs e)
{








practica 5.2 A

practica 5.1 A consola y windows

consola










namespace practica_5._2_consola
{
class Program
{
static void Main(string[] args)
{
int cl;
do{
Console.WriteLine("introduce calificacion");
cl= int.Parse(Console.ReadLine());
Console.WriteLine("la calificacion:{0}",cl);
}
while(cl>=0 cl <=100); Console.Read();

practica en windows

namespace practica_5._3_windows
{
public partial class Form1 : Form
{
int c1;
public Form1()
{
c1 = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
c1 = int.Parse(textBox1.Text);
if (c1 <> 100)
{
textBox1.Enabled = false;
}
else
{
listBox1.Items.Add(c1);
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Enabled = true;
textBox1.Clear();
listBox1.Items.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}


practica 4.4 pies a metros



imagen


programa


class Program
{
static void Main(string[] args)
{
double pies,metros;
pies=2.0;
Console.WriteLine("pies\t\tmetros");
while (pies <= 20.0) { metros = pies/3.28; Console.WriteLine("{0}\t\t{1}", pies,metros); pies=pies+2; } Console.ReadKey();


practica en windows



public partial class Form1 : Form
{
double pies, metro;
public Form1()
{
pies = 2.0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("pies metros");
while (pies <= 20.0) { metro = pies / 3.28; listBox1.Items.Add(pies.ToString() + " " + metro.ToString()); pies = pies + 2.0; }


practica 4.3 grados celsius y faherenheit



imagen


codigo



namespace practica_4._3_consola
{
class Program
{
static void Main(string[] args)
{
double celsius,Fahrenheit;
celsius=-10;
Console.WriteLine("celsius\t\farenheit");
while (celsius <= 60.0) { Fahrenheit=(9.0/5.0)*celsius+32.0; Console.WriteLine("{0}\t\t{1}", celsius,Fahrenheit); celsius = celsius +10; }
Console.ReadKey();






programa en windows



namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
double celsius, fahrenheit;
public Form1()
{
celsius = -10;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("celsius fahrenheit");
while (celsius <= 60.0) { fahrenheit=(9.0/5.0)*celsius+32.0; listBox1.Items.Add(celsius.ToString()+" " + fahrenheit.ToString()); celsius = celsius +10; } } private void button2_Click(object sender, EventArgs e) { Close();

practica 4.2


imagen


codigo

class Program
{
static void Main(string[] args)
{
int angulo;
Console.WriteLine("Introduce el Angulo");
angulo = int.Parse(Console.ReadLine());
if (angulo > 0 && angulo < 90)
Console.WriteLine("Cuadrante 1");
else
{
if (angulo > 90 && angulo < 180)
Console.WriteLine("Cuandrante 2");
else
{
if (angulo > 180 && angulo < 270)
Console.WriteLine("Cuandrante 3");
else
{
if (angulo > 270 && angulo < 360)
Console.WriteLine("Cuandrante 4");
else
{
switch (angulo)
{
case 0:
case 360: Console.WriteLine("Eje positivo x");
break;
case 90: Console.WriteLine("Eje positivo y");
break;
case 180: Console.WriteLine("Eje negativo x");
break;
case 270: Console.WriteLine("Eje negativo y");
break;

}
} Console.ReadKey();

programa en windows



public partial class Form1 : Form
{int angulo;
public Form1()
{angulo = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
angulo = int.Parse(textBox1.Text);
if (angulo > 0 && angulo < 90)
textBox2.Text = ("Cuadrante 1");
else
{
if (angulo > 90 && angulo < 180)
textBox2.Text = ("Cuadrante 2");
else
{
if (angulo > 180 && angulo < 270)
textBox2.Text = ("Cuadrante 3");
else
{
if (angulo > 270 && angulo < 360)
textBox2.Text = ("Cuadrante 4");
else
{
switch (angulo)
{
case 0:
case 360: textBox2.Text = ("Eje Positivo de x");
break;
case 90: textBox2.Text = ("Eje Positivo de y");
break;
case 180: textBox2.Text = ("Eje Negativo de x");
break;
case 270: textBox2.Text = ("Eje Negativo de y");
break;
}
}

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

practica 4

practica 4.1 codigo de seleccion

codigo


class Program
{
static void Main(string[] args)
{
double d2, d3, d4;
Console.WriteLine("Introduce los siguientes codigo 1,2,3 o 4");
Console.WriteLine("\n\nCodijo");
d2 = double.Parse(Console.ReadLine());
Console.WriteLine("\nintroduce primer numero");
d3 = double.Parse(Console.ReadLine());
Console.WriteLine("\nIntroduce segundo numero");
d4 = double.Parse(Console.ReadLine());
if (d2 == 1)
{
Console.WriteLine("\n\nSu suma es ");
d2 = d3 + d4;
}
else
{
if (d2 == 2)
{
Console.WriteLine("\n\nsu resta es ");
d2 = d3 - d4;
}
else
{
if (d2 == 3)
{
Console.WriteLine("\n\nsu multiplicacion es ");
d2 = d3 * d4;
}
else
{
if (d2 == 4)
{
Console.WriteLine("\n\nsu divicion es ");
d2 = d3 / d4;
}
else
{
Console.WriteLine("\n\nError no se puede dividir entre cero ");
d2 = d3 / d4;
d4 = 0;
}
}
}
}
Console.WriteLine("{0}", d2);
Console.ReadKey();






imagen




diagrama de flujo



practica en windowspublic partial class Form1 : Form
{
double d2, d3, d4;
public Form1()
{
d2 = d3 = d4;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
d2 = double.Parse(textBox1.Text);
d3 = double.Parse(textBox2.Text);
d4 = double.Parse(textBox3.Text);
if (d2 == 1)
{
textBox5.Text="Su suma es ";
d2 = d3 + d4;
}
else
{
if (d2 == 2)
{
textBox5.Text="su resta es ";
d2 = d3 - d4;
}
else
{
if (d2 == 3)
{
textBox5.Text="su multiplicacion es ";
d2 = d3 * d4;
}
else
{
if (d2 == 4)
{
textBox5.Text="su divicion es ";
d2 = d3 / d4;
}
else
{
textBox5.Text="Error no se puede dividir entre cero ";
d2 = d3 / d4;
d4 = 0;
}
}
}
}
textBox4.Text = d2.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();


viernes, 16 de octubre de 2009