Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Homework3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] matrix = new int[10, 10];
- Random rand = new Random();
- int max = int.MinValue;
- Console.WriteLine("Исходная матрица:");
- for (int i = 0; i < matrix.GetLength(0); i++)
- {
- for (int j = 0; j < matrix.GetLength(1); j++)
- {
- matrix[i, j] = rand.Next(0, 101);
- if (matrix[i,j] > max)
- {
- max = matrix[i, j];
- }
- Console.Write(matrix[i, j] + "\t");
- }
- Console.WriteLine();
- }
- Console.WriteLine($"Максимальное значение - {max}");
- Console.WriteLine("Новая матрица:");
- for (int i = 0; i < matrix.GetLength(0); i++)
- {
- for (int j = 0; j < matrix.GetLength(1); j++)
- {
- if (matrix[i, j] == max)
- {
- matrix[i, j] = 0;
- }
- Console.Write(matrix[i, j] + "\t");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement