Find If The Given Matrix Is An Upper Triangle Matrix - Java Quiz Question


Write a program to find if the given matrix is an upper triangle matrix.
Assume that matrices are square matrices.

Input (Two Dimensional matrix) Output (boolean)
5   4   5
0   6   2
0   0   8
true
5   2   3   8
0   1   9   7
0   0   0   4
0   0   0   6
true
0   0
0   0
true
0   9   2
8   0   4
6   4   0
false
12   89   77
0   99   66
45   0   111
false



class IsUpperTriangleMatrix
{
    public static void main(String s[])
    {
        int input[][] = {{5, 4, 5}, {0, 6, 2}, {0, 0, 8}};
        System.out.println("The given matrix is an upper triangle matrix : " + isUpperTriangleMatrix(input));

    }


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

}