Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 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 ConsoleApp3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int max = 0;
  14.             Random rand = new Random();
  15.             int[,] array = new int[10,10];
  16.             for (int i = 0; i < array.GetLength(0); i++)
  17.             {
  18.                 for (int j = 0; j < array.GetLength(1); j++)
  19.                 {
  20.                     array[i, j] = rand.Next(10, 99);
  21.                     Console.Write(array[i, j] + " ");
  22.                     if (max < array[i, j])
  23.                     {
  24.                         max = array[i, j];
  25.                     }
  26.                 }
  27.                 Console.WriteLine();
  28.             }
  29.             Console.WriteLine("Максимальное число в массиве: " + max);
  30.             for (int i = 0; i < array.GetLength(0); i++)
  31.             {
  32.                 for (int j = 0; j < array.GetLength(1); j++)
  33.                 {
  34.                     if (max < array[i, j])
  35.                     {
  36.                         max = array[i, j];
  37.                        
  38.                     }
  39.                     if (max == array[i, j])
  40.                     {
  41.                         array[i, j] = 0;
  42.                     }
  43.                     Console.Write(array[i, j] + " ");
  44.                 }
  45.                 Console.WriteLine();
  46.             }
  47.  
  48.  
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement