OBTENER MÁXIMO Y MÍNIMO EN UNA MATRIZ EN C# (CONSOLA)



Programa principal:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace posision_mayor_arreglo_
{
    class Program
    {
        static void Main(string[] args)
        {
            mayor m = new mayor();
            m.ubica();
            Console.ReadKey();
        }
    }
}
Clase mayor:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace posision_mayor_arreglo_
{
    class mayor
    {
        public void ubica()
        {
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.Blue;
            int n, m;
            int mayor,menor;
           
           
           Console.WriteLine(«                  NUMEROS MAYOR Y MENOR DE UNA MATRIZ»);
           Console.WriteLine(«DE CUANTAS FILAS»);
           n = int.Parse(Console.ReadLine());
           Console.WriteLine(«DE CUANTAS COLUMNAS»);
           m = int.Parse(Console.ReadLine());
            int[,] a = new int[n, m];
          
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    Console.Clear();
                    Console.WriteLine(«TECLEA EL ELEMENTO [« + i + «,»+j+«]»);
                    a[i, j] = int.Parse(Console.ReadLine());
                   
                }
              }
            Console.Clear();
            Console.WriteLine(«Los elementos de la matriz son:»);
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(«  «);
                for (int j = 0; j < m; j++)
                {
                    Console.Write(«  «+a[i, j]);
                }
            } Console.WriteLine(» «);
            mayor = menor = a[0, 0];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    if (a[i, j] < menor)
                    {
                        menor = a[i, j];
                    }
                    else
                        if (a[i, j] > mayor)
                        {
                            mayor = a[i, j];
                        }
                }
            }
            Console.WriteLine(«MAXIMO:» + mayor );
            Console.WriteLine(«MINIMO:» + menor );
        }
    }
}
VISITA LAS PÁGINAS:

AU REVOIR!!!