public static void Main(string[] args)
Console.WriteLine("Enter lines");
Console.WriteLine("Enter columns");
arr = new int[int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine())];
for (int line = 0; line < arr.GetLength(0); line++)
for (int column = 0; column < arr.GetLength(1); column++)
Console.WriteLine("Enter number in " + line + column);
arr[line, column] = int.Parse(Console.ReadLine());
Console.WriteLine("Enter lines and columns: ");
int line1 = int.Parse(Console.ReadLine());
int column1 = int.Parse(Console.ReadLine());
Print(Random(line1, column1));
Common(Random(line1, column1));
Console.WriteLine("Enter square array line and column length: ");
int num = int.Parse(Console.ReadLine());
int[,] squarray = new int[num, num];
for (int lines = 0; lines < squarray.GetLength(0); lines++)
for (int cols = 0; cols < squarray.GetLength(1); cols++)
Console.WriteLine("Enter number in " + lines + cols);
squarray[lines, cols] = int.Parse(Console.ReadLine());
public static void Print(int[,] arr)
for (int line = 0; line < arr.GetLength(0); line++)
for (int col = 0; col < arr.GetLength(1); col++)
Console.Write("{0} ", arr[line, col]);
public static int[,] Luahhakefel()
for (int line = 0; line < arr.GetLength(0); line++)
for (int col = 0; col < arr.GetLength(1); col++)
public static int[,] Random(int lines, int cols)
Random rnd = new Random();
int[,] arr = new int[lines, cols];
for (int line = 0; line < arr.GetLength(0); line++)
for (int col = 0; col < arr.GetLength(1); col++)
arr[line, col] = rnd.Next(1, 101);
public static void Common(int[,] arr)
int[] array = new int[100];
for (int i = 0; i < array.Length; i++)
for (int line = 0; line < arr.GetLength(0); line++)
for (int col = 0; col < arr.GetLength(1); col++)
array[arr[line, col] - 1]++;
for (int i = 1; i < array.Length; i++)
Console.WriteLine("Most common number was: {0}", common);
public static void Mainslant(int[,] arr)
for (int i = 0; i < arr.GetLength(0); i++)
Console.WriteLine("Main slant sum is: {0}", sum);
public static void Minorslant(int[,] arr)
for (int i = 0; i < arr.GetLength(0); i++)
sum += arr[i, arr.GetLength(0) - 1 - i];
Console.WriteLine("Minor slant sum is: {0}", sum);