Advertisement
dmitryEfremov

Untitled

Apr 13th, 2020
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.85 KB | None | 0 0
  1. using System;
  2. namespace ConsoleApp5
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             int[,] array = new int[10, 10];
  9.             Console.WriteLine("Заполните массив:");
  10.             for (int i = 0; i < array.GetLength(0); i++)
  11.             {
  12.                 for (int j = 0; j < array.GetLength(1); j++)
  13.                 {
  14.                     array[i, j] = Convert.ToInt32(Console.ReadLine());
  15.                 }
  16.             }
  17.             Console.WriteLine("Вы заполнили массив:");
  18.             for (int i = 0; i < array.GetLength(0); i++)
  19.             {
  20.                 for (int j = 0; j < array.GetLength(1); j++)
  21.                 {
  22.                     Console.Write(array[i, j] + " ");
  23.                 }
  24.                 Console.WriteLine();
  25.             }
  26.             int maxNumbers = int.MinValue;
  27.             int iMaxNumbers = 0; int jMaxNumbers = 0;
  28.             for (int i = 0; i < array.GetLength(0); i++)
  29.             {
  30.                 for (int j = 0; j < array.GetLength(1); j++)
  31.                 {
  32.  
  33.                     if (array[i, j] > maxNumbers)
  34.                     {
  35.                         maxNumbers = array[i, j];
  36.                         iMaxNumbers = i; jMaxNumbers = j;
  37.                     }
  38.                 }
  39.             }
  40.             Console.WriteLine("Наибольший элимент матрицы - " + array[iMaxNumbers, jMaxNumbers]);
  41.             array[iMaxNumbers, jMaxNumbers] = 0;
  42.             Console.WriteLine("Вы изминили массив:");
  43.             for (int i = 0; i < array.GetLength(0); i++)
  44.             {
  45.                 for (int j = 0; j < array.GetLength(1); j++)
  46.                 {
  47.                     Console.Write(array[i, j] + " ");
  48.                 }
  49.                 Console.WriteLine();
  50.             }
  51.         }    
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement