Advertisement
SnowPhoenix347

3.4

Oct 29th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 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 FifthProject
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int max = 0;
  14.             int x = 0;
  15.             int y = 0;
  16.  
  17.             Random random = new Random();
  18.  
  19.             int[,] array = new int[10, 10];
  20.             for (int i = 0; i < array.GetLength(0); i++)
  21.                 for (int j = 0; j < array.GetLength(1); j++)
  22.                     array[i, j] = random.Next();
  23.  
  24.             for (int i = 0; i < array.GetLength(0); i++)
  25.             {
  26.                 for (int j = 0; j < array.GetLength(1); j++)
  27.                 {
  28.                     if (max < array[i, j])
  29.                     {
  30.                         max = array[i, j];
  31.                         x = i;
  32.                         y = j;
  33.                     }
  34.                 }
  35.             }
  36.  
  37.             Console.WriteLine($"Наибольшее число: {max}");
  38.  
  39.             Console.WriteLine("Матрица исходная: ");
  40.             for (int i = 0; i < array.GetLength(0); i++)
  41.             {
  42.                 for (int j = 0; j < array.GetLength(1); j++)
  43.                 {
  44.                     Console.Write(array[i, j]);
  45.                 }
  46.                 Console.WriteLine();
  47.             }
  48.  
  49.             array[x, y] = 0;
  50.  
  51.             Console.WriteLine("Матрица полученная: ");
  52.             for (int i = 0; i < array.GetLength(0); i++)
  53.             {
  54.                 for (int j = 0; j < array.GetLength(1); j++)
  55.                 {
  56.                     Console.Write(array[i, j]);
  57.                 }
  58.                 Console.WriteLine();
  59.             }
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement