Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace dz1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array =
- {
- { 2, 1, 2, 3, 4, 5, 6, 7, 8, 4, },
- { 1, 1, 2, 3, 4, 5, 6, 7, 8, 1, },
- { 5, 1, 2, 3, 4, 5, 6, 7, 8, 3, },
- { 6, 1, 2, 3, 4, 5, 6, 7, 8, 1, },
- { 3, 1, 2, 3, 4, 5, 6, 7, 8, 2, },
- { 3, 1, 2, 3, 4, 5, 6, 7, 8, 5, },
- { 4, 1, 2, 3, 4, 5, 6, 7, 8, 6, },
- { 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, },
- { 6, 1, 2, 3, 4, 5, 6, 7, 8, 5, },
- { 1, 1, 2, 3, 4, 5, 6, 7, 8, 4, },
- };
- int maxValue = int.MinValue;
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- if (maxValue < array[i, j]) maxValue = array[i, j];
- Console.Write($"{array[i, j]} ");
- }
- Console.WriteLine();
- }
- Console.WriteLine("\n\n\n");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- if (array[i, j] == maxValue) array[i, j] = 0;
- Console.Write($"{array[i, j]} ");
- }
- Console.WriteLine();
- }
- Console.WriteLine($"\n{maxValue} Наибольший элемент");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement