using
System;
class
GFG
{
public
static
void
overLapping(
int
N,
int
[,] matrix)
{
int
max, inc = 0, dec, start;
max = 2 * N - 1;
dec = max;
start = N;
while
(start != 0)
{
for
(
int
row = 0; row < max; row++)
{
for
(
int
col = 0; col < max; col++)
{
if
(row == inc || row == dec - 1 ||
col == dec - 1 || col == inc)
{
matrix[row, col] = start;
}
}
}
start--;
inc++;
dec--;
}
}
public
static
void
DisplayMatrix(
int
[,] matrix,
int
max)
{
for
(
int
row = 0; row < max; row++)
{
for
(
int
col = 0; col < max; col++)
{
Console.Write(
" {0}"
, matrix[row, col]);
}
Console.Write(
"\n"
);
}
}
public
static
void
Main()
{
int
N;
N = 3;
int
[,] matrix =
new
int
[100, 100];
overLapping(N, matrix);
DisplayMatrix(matrix, (2 * N - 1));
}
}