miércoles, 11 de diciembre de 2013

NUMERO MAYOR DE LA MATRIZ

NUMERO MAYOR DE UNA MATRIZ DE 3 X 3


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace MAYORDEUNAMATRIZ

{

    class Program

    {

        static void Main(string[] args)

        {

            int[,] a, b, c;

            int x, y, w, z, e, f,MAYOR;

            string aux;

            a = new int[3, 3];

            b = new int[3, 3];

            c = new int[3, 3];

            x = 5;

            for (e = 0; e < 3; e++)

            {

                f = 0; y = 5;

                while (f < 3)

                {

                    Console.SetCursorPosition(y, x);

                    aux = Console.ReadLine();

                    a[f, e] = int.Parse(aux);

                    f++;

                    y = y + 10;

                }

                x = x + 5;

            }

 

// OJO, AQUÍ SE OBTIENE EL NUMERO MAYOR DE LA MATRIZ

 

            MAYOR = 0;

            for (e = 0; e < 3; e++)

            {

                f = 0; y = 5;

                while (f < 3)

                {

                    if (MAYOR < a[f, e])

                    {

                        MAYOR = a[f, e];

                    }

                    f++;

                }

                x = x + 5;

            }

            Console.SetCursorPosition(50, 5);

            Console.Write(MAYOR);

            Console.ReadKey();

        }

    }

}

No hay comentarios:

Publicar un comentario