C program to implement matrix multiplication

#include<stdio.h>

//matrix multiplication with demo data

int main()
{
int a[2][3]={{1,2,3},{4,5,6}};
int b[3][2]={{10,11},{20,21},{30,31}};
int c[2][2]={0};
int i,j,k;
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
for(k=0;k<3;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++)
{printf(” %d”,c[i][j]);}
printf(“\n”);
}

}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>