Multiplication of two 2D Matrix

6 comments
Guys Hello !! Here is Code in C++ for multiplying two 2D Matrix. It is not the tough as you consider it till now .

















Multiplication on Two matrix a[2][2]*b[2][2]
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
int a[10][10];int b[10][10];int c[10][10];
void main()
{
int i,j,k,l;
clrscr();


cout<<"Enter the value of the matrix a:";
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
cin>>a[i][j];
}
}
cout<<"\n Enter the value of the matrix b:";
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
cin>>b[i][j];
}
}


cout<<"\n The multiplied value is:";
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<<"\n" ;
}

getch();
}


OUTPUT:

6 comments:

Best for beginners

1 September 2016 at 21:36 comment-delete 27 December 2016 at 22:37 comment-delete 6 December 2017 at 07:46 comment-delete 22 August 2018 at 04:35 comment-delete

Zbrdst

22 July 2019 at 08:04 comment-delete

not working...

8 December 2019 at 10:41 comment-delete
Post a Comment

Copyright 2011 Programming In C++.
Blogger Template by lordhtml / Free Blogger Template