lunes, 7 de diciembre de 2009

PRACTICA #10-3 (ARREGLO BIDIMENSIONAL)

Pseudocodigo
INICIO REAL[,] voltajes=new double[3,5];
REAL c1 =0,c2=0,r=0,c=0,suma1=0,suma2=0;

for (r = 0 TO 3 r=r+1)
{

for (c = 0 TO 5; c= c+1)
{
PRINT "Voltajes [{0},{1}] : ", r, c

READ voltajes[r, c]

} }
for (r = 0 TO 3; r=r+1)

{

for (c = 0 TO 5; c=c+1)
{
if (voltajes[r, c] <> { c1 = c1 + 1;
}
else { if (voltajes[r, c] >= 60)

{
c2 = c2 + 1;
}
} } }
PRINT "No. de Voltajes <60>=60 : {1}", c1,c2);
FIN


CONSOLA


double[,] voltajes = new double[3, 5];
int SUMA1 = 0, SUMA2 = 0, r = 0, c = 0;
for (r = 0; r <>
{ for (c = 0; c <>
{ Console.Write("Voltajes [{0},{1}] : ", r, c);
voltajes[r, c] = double.Parse(Console.ReadLine());
} }
for (r = 0; r <>

{ for (c = 0; c <>
{ if (voltajes[r, c] <>
{ SUMA1 = SUMA1 + 1;
} else { if (voltajes[r, c] >= 60)
{
SUMA2 = SUMA2 + 1;
}}}}
Console.WriteLine("\n VOLTAJES M
ENORES DE 60 : {0}\n\n VOLTJES MAYORES DE 60 : {1}", SUMA1, SUMA2);
Console.ReadKey();

VISUAL




public partial class Form1 : Form
{
int[,] voltaje = new int[3, 5];
int resistencia = 0;
int corriente = 0;
int c1 = 0, c2 = 0;
public Form1()
{
InitializeComponent();
listBox1.Items.Add("");
}
private void button1_Click(object sender, EventArgs e)
{if (resistencia < corriente =" 0;" resistencia =" 0;" corriente =" 0;" c1 =" c1">= 60)
{
c2 = c2 + 1;
}
}
}
}
textBox2.Text = ("Numero de Voltajes <60 text =" (">=60 es: " + c2.ToString());
}
private void button3_Click_1(object sender, EventArgs e)
{ textBox1.Clear();
listBox1.Items.Clear();
textBox2.Clear();
textBox3.Clear();
}
}
}




No hay comentarios:

Publicar un comentario