Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Les3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int max_int = 0;
- int[,] arr =
- {
- {4, 5, 3, 5, 7, 8, 1, 4, 1, 0 },
- {1, 8, 7, 4, 2, 4, 2, 7, 8, 1 },
- {2, 4, 0, 1, 5, 4, 7, 2, 1, 0 },
- {1, 5, 3, 2, 7, 4, 6, 2, 1, 1 },
- {2, 7, 2, 3, 1, 2, 4, 5, 6, 2 },
- {3, 1, 5, 2, 1, 2, 6, 8, 1, 2 },
- {2, 4, 1, 7, 5, 4, 7, 3, 1, 0 },
- {3, 4, 2, 6, 7, 7, 1, 4, 2, 1 },
- {1, 5, 1, 0, 6, 3, 8, 1, 2, 1 },
- {3, 6, 1, 4, 2, 3, 3, 6, 5, 3 }
- };
- Console.WriteLine("Исходная матрица:");
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- for (int j = 0; j < arr.GetLength(1); j++)
- {
- Console.Write(arr[i, j] + " ");
- if (arr[i, j] > max_int)
- max_int = arr[i, j];
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine("Наибольший элемент: " + max_int);
- Console.WriteLine("\nПолученная матрица:");
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- for (int j = 0; j < arr.GetLength(1); j++)
- {
- if (arr[i, j] == max_int)
- arr[i, j] = 0;
- Console.Write(arr[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement