Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Matrix
- {
- class Program
- {
- static void Main(string[] args)
- {
- MatrixMethod();
- }
- static void MatrixMethod()
- {
- int[,] arr = { { 21, 19, 113, 55 }, { 33, 15, 60, 7 } };
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- for (int j = 0; j < arr.GetLength(1); j++)
- {
- Console.Write("{0,4}", arr[i, j]);
- }
- Console.WriteLine();
- }
- int max = arr[0, 0];
- int min = arr[0, 0];
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- for (int j = 0; j < arr.GetLength(1); j++)
- {
- if (arr[i, j] > max)
- {
- max = arr[i, j];
- }
- if (arr[i, j] < min)
- {
- min = arr[i, j];
- }
- }
- }
- Console.WriteLine("Max= " + max);
- Console.WriteLine("Min= " + min );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement