Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Basic_Task13
- {
- class Program
- {
- static void Main(string[] args)
- {
- const int SIZE = 10;
- bool isFirst = true;
- int[,] array = new int[SIZE, SIZE]{
- {1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
- {5, 3, 8, 4, 123, 453, 863, 23, 563, 12},
- {-5, -2, -10, 0, -34, -1000, -234, -5432, -67, -1},
- {3, 0, 8, 1, 1, 1, 2, 5, 3, 10},
- {3, 0, 8, 1, 1, 1, 2, 5, 3, 10},
- {3, 0, 8, 1, 1, 1, 2, 5, 3, 10},
- {3, 0, 8, 1, 1, 1, 2, 5, 3, 10},
- {3, 0, 8, 1, 1, 1, 2, 5, 3, 10},
- {3, 0, 8, 1, 1, 1, 2, 5, 3, 10},
- {3, 0, 8, 1, 1, 1, 2, 5, 3, 863}
- };
- int max = array[0, 0];
- foreach (int i in array)
- {
- if (i > max)
- {
- max = i;
- }
- }
- Console.WriteLine("Наибольший элемент: " + max);
- Console.WriteLine();
- Console.WriteLine("Исходная матрица:");
- for (int i = 0; i < SIZE; i++)
- {
- for (int j = 0; j < SIZE; j++)
- {
- Console.Write(array[i,j] + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < SIZE; i++)
- {
- for (int j = 0; j < SIZE; j++)
- {
- if (max == array[i,j] && isFirst)
- {
- array[i,j] = 0;
- isFirst = false;
- }
- }
- }
- Console.WriteLine();
- Console.WriteLine("Полученная матрицав:");
- for (int i = 0; i < SIZE; i++)
- {
- for (int j = 0; j < SIZE; j++)
- {
- Console.Write(array[i,j] + " ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement