Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Velsimir/a7df23425565a7906e21da9e74cd2d87 to your computer and use it in GitHub Desktop.
Save Velsimir/a7df23425565a7906e21da9e74cd2d87 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Security.Policy;
using System.Threading;
namespace iJunior
{
class MainClass
{
public static void Main(string[] args)
{
int[,] array =
{
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
{15, 123, 43, 76, 34, 334, 768, 325, 222, 523},
{54, 43, 23, 56, 78, 43, 234, 645, 346, 253},
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
{15, 123, 43, 76, 34, 334, 768, 325, 222, 523},
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
{54, 43, 23, 56, 78, 43, 234, 645, 346, 253},
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
{54, 43, 23, 56, 78, 43, 234, 645, 346, 253},
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
};
int maxValue = int.MinValue;
int changeNumber = 0;
Console.WriteLine("Изначальный массив");
for (int i = 0; i < array.GetLength(0); i++)
{
for (int j = 0; j < array.GetLength(0); j++)
{
Console.Write(array[i,j] + "\t");
if (maxValue < array[i,j])
{
maxValue = array[i, j];
}
}
Console.WriteLine();
}
Console.WriteLine();
Console.WriteLine("Полученный массив");
for (int i = 0; i < array.GetLength(0); i++)
{
for (int j = 0; j < array.GetLength(0); j++)
{
if (maxValue == array[i, j])
{
array[i, j] = changeNumber;
}
Console.Write(array[i, j] + "\t");
}
Console.WriteLine();
}
Console.WriteLine($"\nМаксимальное значение в массиве = {maxValue}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment