Created
September 23, 2021 12:11
-
-
Save Ana19997/b1c0f9ede192aaa161fe80206716d33f to your computer and use it in GitHub Desktop.
This file contains 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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApp9 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int[,] array = new int[10, 10]; | |
Random rand = new Random(); | |
Console.WriteLine(); | |
int maxElement = int.MinValue; | |
int maxElementIndex = -1; | |
for (int i = 0; i < array.GetLength(0); i++) | |
{ | |
for (int j = 0; j < array.GetLength(1); j++) | |
{ | |
array[i, j] = rand.Next(0, 100); | |
Console.Write(array[i, j] + " "); | |
if (maxElement < array[i, j]) | |
{ | |
maxElement = array[i, j]; | |
maxElementIndex = i; | |
} | |
} | |
Console.WriteLine(); | |
} | |
Console.WriteLine(" "); | |
for (int i = 0; i < array.GetLength(0); i++) | |
{ | |
for (int j = 0; j < array.GetLength(1); j++) | |
{ | |
if (array[i, j] == maxElement) | |
{ | |
array[i, j] = 0; | |
} | |
Console.Write(array[i, j] + " "); | |
} | |
Console.WriteLine(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment