using System;
public class Program
{
public static void PrintMatrix(int[,] matrix) {
for (int i = 0; i < matrix.GetLength(0); i++) {
for (int j = 0; j < matrix.GetLength(1); j++) {
Console.Write(matrix[i, j].ToString().PadLeft(4) + " ");
}
Console.WriteLine();
}
}
private static int[,] CreateMatrixWithRandomNumbers(int rows, int columns) {
Random random = new Random();
int[,] matrix = new int[rows, columns];
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
matrix[i, j] = random.Next(1, 101);
}
}
return matrix;
}
static void Main(string[] args)
{
int[,] matrix = CreateMatrixWithRandomNumbers(4, 5);
PrintMatrix(matrix);
}
}
/*
run:
74 91 40 46 15
96 21 3 49 69
15 12 40 25 56
69 6 56 2 70
*/