Created
August 24, 2024 11:48
-
-
Save IvanEnginer/cc9809a24c77a70e838cd4775bcd14ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace HW_02 | |
| { | |
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| int minLines = 10; | |
| int maxLines = 20; | |
| int minColums = 10; | |
| int maxColums = 20; | |
| int minValueOfNumber = 100; | |
| int maxValueOfNumber = 1000; | |
| int maxNumber = 0; | |
| int lines = new Random().Next(minLines, maxLines); | |
| int columns = new Random().Next(minColums, maxColums); | |
| Random randomNumber = new Random(); | |
| int[,] array = new int[lines, columns]; | |
| for (int i = 0; i < lines; i++) | |
| { | |
| for (int j = 0; j < columns; j++) | |
| { | |
| array[i, j] = randomNumber.Next(minValueOfNumber, maxValueOfNumber); | |
| } | |
| } | |
| Console.WriteLine("Массив\n"); | |
| for (int i = 0; i < lines; i++) | |
| { | |
| for (int j = 0; j < columns; j++) | |
| { | |
| Console.Write(array[i, j] + " "); | |
| } | |
| Console.WriteLine(); | |
| } | |
| for (int i = 0;i < lines; i++) | |
| { | |
| for(int j = 0;j < columns; j++) | |
| { | |
| if(array[i, j] > maxNumber) | |
| maxNumber = array[i, j]; | |
| } | |
| } | |
| Console.WriteLine($"\nМаксимальное число в массиве: {maxNumber}"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment