elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


  Mostrar Temas
Páginas: [1]
1  Programación / .NET (C#, VB.NET, ASP) / ayuda en matrices c# !! en: 7 Noviembre 2011, 00:16 am
hola que tal? soy nuevo en este foro!! enrrealidad me parecio exelente asi que me registre y pense que podrian ayudarme!!
soy relativamente nuevo en la programacion..en la universidad me mandaron a resolver los siguientes ejercicios en c#  !! :o

1*- Llene una matriz 3x3 muéstrela en su forma original y también en forma inversa (es decir el primer elemento se convertirá en el ultimo, y así sucesivamente)

2*- Cargue una matriz de 3x4, y dado un valor determinado, localice la cantidad de veces que se repite.

2*- Cargue una matriz 3x3, ordénela en forma ascendente y muéstrela.

muchas gracias por su atencion!! espero puedan ayudarme!! saludos!

esto es lo que e hecho del primer ejercicio ....me podrian corregir los errores ?


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

namespace matriz_ejercicio_x
{
    class Program
    {
        static void Main(string[] args)
        {

            //declaramos
            int[,] matriz1 = new int[4, 50];
            int x, j;
            int sumacolumna=0,prom=0;
            //dejamos una matriz vacia
            int[,] matriz2 = new int[4, 50];

            //Pedimos Valores de la matriz

            for (x = 0; x <= 2; x++)
            {
                for (j = 0; j <= 2; j++)
                {
                    Console.WriteLine(" ingrese el elemento [{0},{1}] de la matriz", x + 1, j + 1);
                    matriz1[x, j] = int.Parse(Console.ReadLine());
                }
            } Console.WriteLine();


            //mostraar matriz
            Console.WriteLine("Matriz Cargada");
            Console.WriteLine();
            for (x = 0; x <= 2; x++)
            {
                for (j = 0; j <= 2; j++)
                    Console.Write("    {0}    ", matriz1[x, j]);
                Console.WriteLine();
            }
            for (x = 0; x <= 2; x++)
            {
                for (j = 0; j <= 2; j++)

                    sumacolumna = sumacolumna + matriz1[x, j];
                prom = sumacolumna / 3;
                matriz1[3, j] = prom;
            }
                 for (x = 0; x <= 3; x++)
            {
                for (j = 0; j <= 3; j++)
                Console.Write("   {0}   ",matriz1[4, j]);
            }
            Console.ReadLine();
               

        }
    }
}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines