Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StartCode]
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp2
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[,] slot = new int[10,10];
- int maxSlot = 0;
- int zeroSlot = 0;
- Random random = new Random();
- Console.WriteLine("Изначальная матрица : ");
- for (int i = 0; i < slot.GetLength(0); i++)
- {
- for (int j = 0; j < slot.GetLength(1); j++)
- {
- Console.Write((slot[i, j]=random.Next(1,10)) + " ");
- if(slot[i, j] > maxSlot)
- {
- maxSlot = slot[i, j];
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine("Максимальное число в матрице : " + maxSlot);
- for (int i = 0; i < slot.GetLength(0); i++)
- {
- for (int j = 0; j < slot.GetLength(1); j++)
- {
- if(slot[i, j] == maxSlot)
- {
- slot[i, j] = zeroSlot;
- }
- }
- }
- Console.WriteLine("Изменённая матрица : ");
- for (int i = 0; i < slot.GetLength(0); i++)
- {
- for (int j = 0; j < slot.GetLength(1); j++)
- {
- Console.Write((slot[i, j]) + " ");
- }
- Console.WriteLine();
- }
- }
- }
- }
- [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment