Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp16.MaxValue
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array = new int[10, 10];
- Random rand = new Random();
- int maxValue = 0;
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = rand.Next(10, 100);
- Console.Write(array[i, j] + " ");
- if (maxValue < array[i,j])
- {
- maxValue = array[i, j];
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine($"\nМаксимальное значение: {maxValue}.\n");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- if (maxValue == array[i, j])
- {
- array[i, j] = 0;
- Console.Write(" ");
- }
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement