Using System;
public class BorderedMatrix
{
private int[,] matrix;
private int inSize, S;
public BorderedMatrix(int size)
{
inSize = size;
S = inSize + 2;
matrix = new int[S,S];
/* 0 */
for (int i = 0; i < S; i++) {
matrix[0,i] = 0;
matrix[S-1,i] = 0;
}
for (int i = 1; i < S - 1; i++) {
matrix[i,0] = 0;
matrix[i,S-1] = 0;
}
}
public void FillInput()
{
Console.WriteLine($"Введите матрицу {inSize}x{inSize}");
for (int i = 1; i < S - 1; i++) {
for (int j = 1; j < S - 1; j++) {
Console.Write($"[{i}][{j}] = ");
matrix[i,j] = Convert.ToInt32(Console.ReadLine());
}
}
Console.WriteLine();
}
public void Print()
{
for (int i = 0; i < S; i++) {
for (int j = 0; j < S; j++) {
Console.Write($"{matrix[i,j]} ");
}
Console.WriteLine();
}
}
}
public class MainClass
{
public static void Main()
{
const int SIZE = 4;
BorderedMatrix matrix = new BorderedMatrix(4);
matrix.FillInput();
matrix.Print();
}
}