LeRoY_Go

Untitled

Jan 29th, 2022
1,188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using System;
  2.  
  3. namespace C_Sharp_Junior
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int[,] array = new int[10, 10];
  10.             int maxValue = 0;
  11.             Random random = new Random();
  12.  
  13.             for (int i = 0; i < array.GetLength(0); i++)
  14.             {
  15.                 for (int j = 0; j < array.GetLength(1); j++)
  16.                 {
  17.                     array[i, j] = random.Next(10, 99);
  18.                     if (maxValue < array[i, j])
  19.                     {
  20.                         maxValue = array[i, j];
  21.                     }
  22.                     Console.Write(array[i, j] + " ");
  23.                 }
  24.                 Console.WriteLine();
  25.             }
  26.             Console.WriteLine("\n\n");
  27.             for (int i = 0; i < array.GetLength(0); i++)
  28.             {
  29.                 for (int j = 0; j < array.GetLength(1); j++)
  30.                 {
  31.                     if (array[i, j] == maxValue)
  32.                     {
  33.                         Console.ForegroundColor = ConsoleColor.Red;
  34.                         array[i, j] = 0;
  35.                     }
  36.                     Console.Write(array[i, j] + " ");
  37.                     Console.ResetColor();
  38.                 }
  39.                 Console.WriteLine();
  40.             }
  41.             Console.ReadKey();
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment