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 СSLight13
- {
- class Program
- {
- static void Main(string[] args)
- {
- int max = 0;
- int[,] array = new int[10, 10];
- Random random = new Random();
- Console.WriteLine("Исходная матрица:");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = random.Next(0, 100);
- Console.Write(array[i, j] + " ");
- if (array[i, j] > max)
- {
- max = array[i, j];
- }
- }
- Console.WriteLine();
- }
- 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.WriteLine();
- Console.WriteLine("Полученная матрица:");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement