#include<iostream>
using namespace std;
int main() {
    int r,c,i,j,a[5][5],b[5][5],product[5][5];
    
    cout<<"enter the number of rows\n";
    cin>>r;
    
    cout<<"enter the number of columns\n";
    cin>>c;
    
    cout<<"enter the elements of matrix a\n";
    for(i=0;i<r;i++){
        for(j=0;j<c;j++) {
            cin>>a[i][j];
        }
    }
    
    cout<<"enter the elements of matrix b\n";
    for(i=0;i<r;i++){
        for(j=0;j<c;j++) {
             cin>>b[i][j];
        }
    }
    
    for(i=0;i<r;i++){
        for(j=0;j<c;j++) {
            product[i][j]=a[i][j]*b[i][j];
        }
    }
    
    cout<<"product of the two matrices is";
    for(i=0;i<r;i++){
        for(j=0;j<c;j++) {
            cout<<product[i][j];
        }
    }
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: