How to multiply in array?

Below code will help you to make program on multiplying of array.

#include<stdio.h>
#include<conio.h>
void main ()
{
int a[2][2]={{1,2},{3,4}},b[2][2]={{1,2},{2,2}},c[2][2]={0},i,j,k,m=2,n=2,r=2;
clrscr();
for(i=0;i<=m-1;i++)
for(j=0;j<=n-1;j++)
for(k=0;k<=r-1;k++)
c[i][k]=c[i][k]+a[i][j] * b[j][k];
printf(“Multiply of Matrix is here:\n”);
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
printf(“%4d”,c[i][j]);
printf(“\n”);
}
getch();
}

 

After running above program:-

Leave a Reply