Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- const int size = 10;
- int[,] matrix = new int[size, size];
- matrix[2, 7] = 10;
- matrix[3, 1] = 99;
- matrix[5, 5] = 154;
- Console.WriteLine("Исходная матрица");
- int max = matrix[0, 0], k = 0, m = 0;
- foreach (int x in matrix)
- {
- Console.Write(x + " ");
- }
- for (int i = 0; i < size; i++)
- for (int j = 0; j < size; j++)
- if (matrix[i, j] > max)
- {
- max = matrix[i, j];
- k = i;
- m = j;
- }
- Console.WriteLine();
- Console.WriteLine("Максимальный элемент = " + max);
- matrix[k, m] = 0;
- Console.WriteLine("Новая матрица, с заменой на 0 ");
- foreach (int x in matrix)
- {
- Console.Write(x + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment