using System;
public class IdtMat
{
public static void Main()
{
int i, j, row, col;
int[,] matA = new int[10,10];
Console.Write("\nEnter the no. of row: ");
i=Convert.ToInt16(Console.ReadLine());
Console.Write("Enter the no. of col: ");
j=Convert.ToInt16(Console.ReadLine());
Console.WriteLine("\nEnter the Element in Matrix: ");
for(row=0; row<i; row++)
{
for(col = 0; col<j; col++)
matA[row,col]= Convert.ToInt16(Console.ReadLine());
Console.WriteLine();
}
Console.WriteLine("\nMatrix A: ");
for(row=0; row<i; row++)
{
for(col = 0; col<j; col++)
Console.Write("{0:D2} ", matA[row,col]);
Console.WriteLine();
}
for(row = 0; row < i; row++)
{
for(col = 0; col<j; col++)
{
if ((row == col && matA[row, col] == 1) && (row != col && matA[row, col] == 0))
{
goto lable;
}
else
{
Console.WriteLine("\n Not an Identity Matrix");
row=col=i;
}
}
}
lable: Console.WriteLine("Identity matrix");
Console.ReadLine();
}
}