Menu
Question Index
...

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[][]) {
    }

}

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App