Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- int max = 0;
- int[,] array = new int[10,10];
- Random rand = new Random();
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = rand.Next(1,9);
- Console.Write(array[i,j] + " ");
- if(array[i,j]> max)
- {
- max = array[i, j];
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine(max);
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- if (array[i, j] == max)
- {
- array[i,j] = 0;
- }
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement