Menu
Question Index
...


Write a program to get the inverse of 2 x 2 matrix with proper error checking.

Input (Two Dimensional matrix) Output (Two Dimensional matrix)
20  45
2  5
0.5  -4.5
-0.2  2.0
-1  2
3  -7
-7.0  -2.0
-3.0  -1.0
25  20
5   4
null
{}(EMPTY ARRAY) null
null null

class AdvanceInverseOf2X2Matrix

{    public static void main(String s[])
    {
        int input[][] = {{20, 45}, {2, 5}};
        double output[][] = getInverse(input);
        if (output != null) {
        for (double[] array1d : output) {
        for (double element : array1d) {
        System.out.print(element + "   ");
        }
        System.out.println();
        }
        } else {
        System.out.println("Inverse of matrix should not be performed due to invalid input data.");
        }

    }


public static double[][] getInverse(int matrix[][]) {
//Write code here to get the inverse of given 2 x 2 matrix and return the result.
}

public static int getDeterminant(int matrix[][]) {
int result = 0;
//Write code here to get the determinant of given 2 x 2 matrix.
return result;
}
}

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