Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- public class Program
- {
- public static void Main()
- {
- int minNumber, maxNumber;
- int[,] matrix = new int[5, 5] { { 1, 2, 8, 9, 5 }, { 4, 6, 7, 3, 5 }, { 1, 8, 9, 7, 5 }, { 6, 3, 2, 8, 1 }, { 4, 7, 9, 3, 2 } };
- minNumber = matrix[0, 0];
- maxNumber = matrix[0, 0];
- for (int i = 0; i <= matrix.GetLength(0) - 1; i++)
- {
- for (int j = 0; j <= matrix.GetLength(1) - 1 - 1; j++)
- {
- if (matrix[i, j] < minNumber)
- {
- minNumber = matrix[i, j];
- }
- if (matrix[i, j] > maxNumber)
- {
- maxNumber = matrix[i, j];
- }
- }
- }
- Console.WriteLine(minNumber + " " + maxNumber);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement