Benjail

3.4

Aug 29th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. using System;
  2.  
  3. namespace IMJunior
  4. {
  5.     class Program
  6.     {
  7.        
  8.         static void Main(string[] args)
  9.         {
  10.             Random rand = new Random();
  11.             const int N = 10;
  12.             int I=0, J=0,Max=0;
  13.             int[,] B = new int[N, N];//матрица ранодмных чисел
  14.             int[,] A = new int[N, N];//полученная матрица
  15.             for (int i = 0; i < N; i++)
  16.             {
  17.                 for (int j = 0; j < N; j++)
  18.                 {
  19.                     A[i, j] = rand.Next(0, 100);
  20.                     Console.Write(A[i, j] + " ");
  21.                     B[i, j] = A[i, j];
  22.                    if (A[i, j] > Max)
  23.                     {
  24.                         Max = A[i, j];
  25.                         I = i;
  26.                         J = j;
  27.                     }
  28.                 }
  29.                 Console.WriteLine();
  30.             }
  31.             Console.WriteLine("Максимальный элемент = "+Max);
  32.             B[I, J] = 0;
  33.             for (int i = 0; i < N; i++)
  34.             {
  35.                 for (int j = 0; j < N; j++)
  36.                 {
  37.                     Console.Write(B[i, j] + " ");
  38.                 }
  39.                 Console.WriteLine();
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment