Advertisement
Guest User

3,3

a guest
Oct 13th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.09 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 d = 0;
  14.             int e = 0;
  15.  
  16.             int[,] array = new int[10, 10];
  17.             Random random = new Random();
  18.  
  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.                 }
  25.             }
  26.             Console.WriteLine("Исходная матрица:");
  27.             for (int i = 0; i < array.GetLength(0); i++)
  28.             {
  29.  
  30.                 for (int j = 0; j < array.GetLength(1); j++)
  31.                 {
  32.                     Console.Write(array[i, j] + " ");
  33.                 }
  34.                 Console.WriteLine();
  35.             }
  36.  
  37.             for (int i = 0; i < array.GetLength(0); i++)
  38.             {
  39.  
  40.                 for (int j = 0; j < array.GetLength(1); j++)
  41.                 {
  42.                     if (array[i, j] > d)
  43.                     {
  44.                         d = array[i, j];
  45.                     }
  46.                 }
  47.             }
  48.             Console.WriteLine();
  49.             Console.WriteLine("Наибольшее число в массиве = " + d);
  50.             for (int i = 0; i < array.GetLength(0); i++)
  51.             {
  52.  
  53.                 for (int j = 0; j < array.GetLength(1); j++)
  54.                 {
  55.                     if (array[i, j] == d)
  56.                     {
  57.                         array[i, j] = 0;
  58.                     }
  59.                 }
  60.             }
  61.             Console.WriteLine();
  62.             Console.WriteLine("Полученная матрица:");
  63.             for (int i = 0; i < array.GetLength(0); i++)
  64.             {
  65.  
  66.                 for (int j = 0; j < array.GetLength(1); j++)
  67.                 {
  68.                     Console.Write(array[i, j] + " ");
  69.                 }
  70.                 Console.WriteLine();
  71.             }
  72.         }
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement