Showing posts with label Simple-Determinant. Show all posts
Showing posts with label Simple-Determinant. Show all posts

Wednesday, June 29, 2022

Simple-Determinant

 Simple-Determinant

Problem Statement
You are given a 2X2 square matrix. You need to find the determinant of the matrix.

import java.io.*; // for handling input/output
import java.util.*; // contains Collections framework

// don't change the name of this class
// you can add inner classes if needed
class Main {
    public static void main (String[] args) {
                      // Your code here
        Scanner sc = new Scanner(System.in);
    int a[][]=new int[2][2];
    for(int i=0;i<2;i++)
    {
        for(int j=0;j<2;j++)
        {
            a[i][j]=sc.nextInt();
            
        }
    }System.out.println((a[0][0] * a[1][1]) - (a[0][1] * a[1][0]));
    }}

ads vert

Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody

  Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody < table >      < thead >    ...