Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Dynamic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace CSLight
- {
- class Program
- {
- static void Main(string[] args)
- {
- int maxElement = int.MinValue;
- int repeatNumber = 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, 99);
- Console.Write(array[i, j] + "\t");
- if (maxElement < array[i, j])
- {
- maxElement = array[i, j];
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine();
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- if (maxElement == array[i, j])
- {
- repeatNumber++;
- array[i, j] = 0;
- }
- Console.Write(array[i, j] + "\t");
- }
- Console.WriteLine();
- }
- Console.WriteLine($"Максимальное число: {maxElement}, число повторяетя: {repeatNumber}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment