Find If The Given Matrix Is A Scalar Matrix - Java Quiz Question


Write a program to find if the given matrix is a scalar matrix.

Input (Two Dimensional matrix) Output (boolean)
1   0   0
0   1   0
0   0   1
true
-3   0   0   0
0  -3   0   0
0   0  -3   0
0   0   0  -3 
true
7   0
0  7
true
6   0   0
0   6   0
0   0   0
false
12   89   77
23   99   66
45   100   111
false



class IsScalarMatrix
{
    public static void main(String s[])
    {
        int input[][] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
        System.out.println("The given matrix is a scalar matrix : " + isScalarMatrix(input));

    }


    public static boolean isScalarMatrix(int matrix[][]) {
    }

}