<span>using System;
class Program
{
static void Main()
{
var random = new Random(DateTime.Now.Millisecond);
int n = 4;
var a = new int[n, n];
Console.WriteLine("A:");
for (var i = 0; i < n; i++)
{
for (var j = 0; j < n; j++)
{
a[i, j] = random.Next(0, 9);
Console.Write(a[i, j] + " ");
}
Console.WriteLine();
}
Console.WriteLine();
for(int j = 0; j < n; j++) {
a[0, j] = 0; a[n-1, j] = 0;
a[j, 0] = 0; a[j, n-1] = 0;
}
Console.WriteLine("new A:");
for (var i = 0; i < n; i++)
{
for (var j = 0; j < n; j++)
Console.Write(a[i, j] + " ");
Console.WriteLine();
}
Console.WriteLine();
Console.ReadKey();
}
<span> }
Пример:
</span><span>A:
5 1 6 4
2 5 7 4
3 1 5 8
4 8 5 8
new A:
0 0 0 0
0 5 7 0
0 1 5 0
0 0 0 0 </span></span>