Friday, 17 November 2017

Java Program to Check Multiplicability of Two Matrices


Code:

import java.util.Scanner;

public class Multiplicability_Matrix 
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the dimension of the matrix:\n ");
        int rowA = sc.nextInt();
        int colA = sc.nextInt();

        System.out.println("Enter the dimension of the other matrix:\n ");
        int rowB = sc.nextInt();
        int colB = sc.nextInt();

        if(colA == rowB)
        {
            System.out.println("Matrices are multipilcable");
        }
        else
        {
            System.out.println("Matrices are not multipilcable");
        }
        sc.close();

    }
}


Output:

Enter the dimension of the matrix:
1 2
Enter the dimension of the other matrix:
2 3
Matrices are multipilcable


More Java Programs:













100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...