Advertisement
Guest User

3.3

a guest
Oct 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace СSLight13
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int max = 0;
  14.  
  15.             int[,] array = new int[10, 10];
  16.             Random random = new Random();
  17.  
  18.             Console.WriteLine("Исходная матрица:");
  19.             for (int i = 0; i < array.GetLength(0); i++)
  20.             {
  21.                 for (int j = 0; j < array.GetLength(1); j++)
  22.                 {
  23.                     array[i, j] = random.Next(0, 100);
  24.                     Console.Write(array[i, j] + " ");
  25.                     if (array[i, j] > max)
  26.                     {
  27.                         max = array[i, j];
  28.                     }
  29.                 }
  30.                 Console.WriteLine();
  31.             }
  32.  
  33.             Console.WriteLine();
  34.             Console.WriteLine("Наибольшее число в массиве = " + max);
  35.             for (int i = 0; i < array.GetLength(0); i++)
  36.             {
  37.  
  38.                 for (int j = 0; j < array.GetLength(1); j++)
  39.                 {
  40.                     if (array[i, j] == max)
  41.                     {
  42.                         array[i, j] = 0;
  43.                     }
  44.                 }
  45.             }
  46.             Console.WriteLine();
  47.             Console.WriteLine("Полученная матрица:");
  48.             for (int i = 0; i < array.GetLength(0); i++)
  49.             {
  50.  
  51.                 for (int j = 0; j < array.GetLength(1); j++)
  52.                 {
  53.                     Console.Write(array[i, j] + " ");
  54.                 }
  55.                 Console.WriteLine();
  56.             }
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement