Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Наибольший_элемент
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[,] array = new int[10, 10];
- int maxNumber = 0;
- Console.WriteLine("Исходная матрица: ");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- Random random = new Random();
- int randomNumber = random.Next(0, 100);
- array[i, j] = randomNumber;
- if (maxNumber < array[i, j])
- {
- maxNumber = array[i, j];
- }
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine($"Наибольший элемент: {maxNumber}\n");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- if (maxNumber == array[i, j])
- {
- Console.ForegroundColor = ConsoleColor.Red;
- array[i, j] = 0;
- Console.Write("!!");
- Console.ForegroundColor = ConsoleColor.White;
- }
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement