0% found this document useful (0 votes)
26 views

#Include Using Namespace Int Int Int Void Int

The document defines three 2D arrays to store the values of two matrices A and B and the product matrix C. It prompts the user to input the values of A and B, calculates the product of the two matrices by multiplying the elements and adding them, and displays the result.

Uploaded by

Akhmal Haziq
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

#Include Using Namespace Int Int Int Void Int

The document defines three 2D arrays to store the values of two matrices A and B and the product matrix C. It prompts the user to input the values of A and B, calculates the product of the two matrices by multiplying the elements and adding them, and displays the result.

Uploaded by

Akhmal Haziq
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<iostream>

using namespace std;


int a[10][10]; int b[10][10]; int c[10][10];
void main()
{
int i, j, k, l;



cout << "Value of the matrix A1: "<<endl;
for (i = 0; i<2; i++)
{
for (j = 0; j<2; j++)
{
cin >> a[i][j];
}
}
cout << "\nValue of the matrix B1: "<<endl;
for (i = 0; i<2; i++)
{
for (j = 0; j<2; j++)
{
cin >> b[i][j];
}
}


cout << "\nThe multiplied value is: "<<endl;
for (i = 0; i<2; i++)
{
for (j = 0; j<2; j++)
{
c[i][j] = 0;
for (k = 0; k<2; k++)
{
c[i][j] = c[i][j] + (a[i][k] * b[k][j]);
}
}
}
for (i = 0; i<2; i++)
{
for (j = 0; j<2; j++)
{
cout << c[i][j]<<" ";
}
cout << endl;
}


}

You might also like