Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading.Tasks;
- namespace CSharpLight
- {
- public static class Program
- {
- public static void Main()
- {
- int maxValue = int.MinValue;
- int[,] matrix = new int[10, 10];
- Random random = new Random();
- for (int i = 0; i < matrix.GetLength(0); i++)
- {
- for (int j = 0; j < matrix.GetLength(1); j++)
- {
- matrix[i, j] = random.Next(0, 31);
- Console.Write(matrix[i, j] + " ");
- if (matrix[i, j] > maxValue)
- {
- maxValue = matrix[i, j];
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine("\n" + maxValue + "\n");
- for (int i = 0; i < matrix.GetLength(0); i++)
- {
- for (int j = 0; j < matrix.GetLength(1); j++)
- {
- if (matrix[i, j] == maxValue)
- {
- matrix[i,j] = 0;
- }
- Console.Write(matrix[i, j] + " ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment