ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

FUNDAMENTOS DE PROGRAMACION. Vectores 10 números mayor y posición


Enviado por   •  22 de Abril de 2018  •  Ensayos  •  9.985 Palabras (40 Páginas)  •  85 Visitas

Página 1 de 40

                                                                                                         

[pic 1]                                                                                                                          [pic 2]

TECNOLÓGICO NACIONAL DE MÉXICO

INSTITUTO TECNOLÓGICO DE TIJUANA

SUBDIRECCIÓN ACADÉMICA

DEPARTAMENTO DE SISTEMAS Y COMPUTACIÓN

NOMBRE DEL ALUMNO: LEON SALINAS GERARDO

NÚMERO DE CONTROL: 17212341

MATERIA: FUNDAMENTOS DE PROGRMACION

PROFESORA: MARIA LETICIA LOMELI BRIONES

TRABAJO: PROGRAMAS

FECHA: 27/NOVIMEBRE/2017

Vectores 10 números mayor y posición.

   private void cmdEjecutar_Click(object sender, EventArgs e)

        {

            int P,Suma=0,n=0;

            int[] Numeros = new int[10] { 20,15,34,56,45,33,22,11,45,21};

            int Nmayor = Numeros[0];

            for(P=0;P<10;P++)

            {

                txtNumeros.Text = txtNumeros.Text + Numeros[P] + "\r\n";

                if (Numeros[P] % 1 == 0)

                {

                    Suma += Numeros[P];

                }

                if (Numeros[P]>Nmayor)

                {

                   Nmayor=Numeros[P];

                    n=P;

                }

            }

                txtSuma.Text +="La suma de los numeros es"+Suma;

                lblMayor.Text+="El numero mayor es "+Nmayor+" y su posisicon es "+n;

        }

    }

}

Vectores 20 numeros

  private void button1_Click(object sender, EventArgs e)

        {

                 int P, Positivo = 0, Negativo = 0, Suma = 0;

            int[] Numeros = new int[20] { 0, 2, 4, 8, 7, 23, 9, 55, 33, 44, -1, -20, -15, -18, -3, -11, -46, -56, -58, -70 };

            for (P = 0; P < 20; P++)

            {

                Suma = Suma + Numeros[P];

                txtsuma.Text = "La suma de todos los numeros es"+Suma

                if (Numeros[P] > 0)

                {

                    Positivo = Positivo + 1;

                    txtpositivos.Text="La cantidad de los numeros positivos es"+Positivo;

                }

                 else if(Numeros[P] < 0)

                {

                    Negativo = Negativo + 1;

                    txtnegativos.Text="La cantidad de los nuemros negativos es"+Negativo;

                }  

            }

            Positivo.ToString();

            Negativo.ToString();

            }

        private void cmdLimpiar_Click(object sender, EventArgs e)

        {

            txtnegativos.Text="";

            txtpositivos.Text="";

            txtsuma.Text="";

        }

        private void cmdSalir_Click(object sender, EventArgs e)

        {

            Close();  }

Vectores nombres

private void cmdEjecutar_Click(object sender, EventArgs e)

        {

            int P;

            string[] Nombres = new string[5] { "Daniel","Arturo","Rolando","Carlos","Juan" };

            for(P=0;P<5;P++)

            {

                txtnombres.Text = txtnombres.Text + Nombres[P] + "\r\n";

            }

        }

        private void cmdLimpiar_Click(object sender, EventArgs e)

        {

            txtnombres.Text = "";

        }

        private void cmdSalir_Click(object sender, EventArgs e)

        {

            Close();

        }

    }

}

Division entre cero

  private void cmdEjecutar_Click(object sender, EventArgs e)

        {

            int Numero = 0, divisor = 0, Resultado = 0;

            try

            {

                Resultado = (Numero / divisor);

            }

            catch (System.DivideByZeroException aviso)

            {

                MessageBox.Show("Error" + aviso);

            }

            finally

            {

                lblLetrero.Text = "Fin de validacion";

            }

        }

        private void cmdLimpiar_Click(object sender, EventArgs e)

        {

            lblLetrero.Text = "";

        }

        private void cmdSalir_Click(object sender, EventArgs e)

...

Descargar como (para miembros actualizados) txt (23 Kb) pdf (123 Kb) docx (40 Kb)
Leer 39 páginas más »
Disponible sólo en Clubensayos.com