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 ConsoleApp3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = 10, maxValue = 0, toChangeX = 0, toChangeY = 0;
- int[,] matrix1 = new int[n, n];
- Random rand = new Random();
- for (int i = 0; i < matrix1.GetLength(0); i++)
- {
- for (int j = 0; j < matrix1.GetLength(1); j++)
- {
- matrix1[i, j] = rand.Next(10, 100);
- Console.Write(matrix1[i, j] + " ");
- if (maxValue < matrix1[i, j])
- {
- maxValue = matrix1[i, j];
- toChangeX = j;
- toChangeY = i;
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine();
- Console.WriteLine("Максимальное значение: " + maxValue);
- matrix1[toChangeY, toChangeX] = 0;
- Console.WriteLine();
- for (int i = 0; i < matrix1.GetLength(0); i++)
- {
- for (int j = 0; j < matrix1.GetLength(1); j++)
- {
- Console.Write(matrix1[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement