Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Homework3_2
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int maxNumberArray = int.MinValue;
- int minNumber = 1;
- int maxNumber = 20;
- int numberReplacingMaxNumberArray = 0;
- int[,] numbers = new int[10, 10];
- Console.WriteLine("Исходная матрица:");
- for (int i = 0; i < numbers.GetLength(0); i++)
- {
- for (int j = 0; j < numbers.GetLength(1); j++)
- {
- numbers[i, j] = random.Next(minNumber, maxNumber + 1);
- if (maxNumberArray <= numbers[i, j])
- {
- maxNumberArray = numbers[i,j];
- }
- Console.Write(numbers[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine("Полученая матрица:");
- for (int i = 0; i < numbers.GetLength(0); i++)
- {
- for (int j = 0; j < numbers.GetLength(1); j++)
- {
- if (numbers[i, j] == maxNumberArray)
- {
- numbers[i, j] = numberReplacingMaxNumberArray;
- }
- Console.Write(numbers[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine("Найбольший элемент: " + maxNumberArray);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement