Neon1x1st

3.2

Feb 14th, 2022 (edited)
871
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. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace CSharpLight
  7. {
  8.     public static class Program
  9.     {
  10.         public static void Main()
  11.         {
  12.             int maxValue = int.MinValue;
  13.             int[,] matrix = new int[10, 10];
  14.             Random random = new Random();
  15.  
  16.             for (int i = 0; i < matrix.GetLength(0); i++)
  17.             {
  18.                 for (int j = 0; j < matrix.GetLength(1); j++)
  19.                 {
  20.                     matrix[i, j] = random.Next(0, 31);
  21.                     Console.Write(matrix[i, j] + " ");
  22.                     if (matrix[i, j] > maxValue)
  23.                     {
  24.                         maxValue = matrix[i, j];
  25.                     }
  26.                 }
  27.                 Console.WriteLine();
  28.             }
  29.             Console.WriteLine("\n" + maxValue + "\n");
  30.  
  31.             for (int i = 0; i < matrix.GetLength(0); i++)
  32.             {
  33.                 for (int j = 0; j < matrix.GetLength(1); j++)
  34.                 {
  35.                     if (matrix[i, j] == maxValue)
  36.                     {
  37.                         matrix[i,j] = 0;
  38.                     }
  39.                     Console.Write(matrix[i, j] + " ");
  40.                 }
  41.                 Console.WriteLine();
  42.             }
  43.         }
  44.     }
  45. }
Add Comment
Please, Sign In to add comment