Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Dynamic;
- using System.Globalization;
- namespace Наибольший_элемент
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array = new int[9, 9];
- int maximumNumber = 0;
- int column = 0;
- int row = 0;
- Random rand = new Random();
- Console.WriteLine("Исходная матрица:\n");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = rand.Next(101, 1000);
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine("\nИзмененная матрица:\n");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- if (array[row,column] < array[i, j])
- {
- row = i;
- column = j;
- }
- }
- }
- maximumNumber = array[row, column];
- array[row, column] = 0;
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine("\nНаибольший элемент:" + maximumNumber);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement