World's most popular travel blog for travel bloggers.

Write a C program to perform the following operation on matrices D = A + (B * C), where A, B and C are matrices of (3 X 3) size and D is the resultant matrix.

, , No Comments

Ans.
#include<stdio.h>
#include<conio.h>
Void main()
{
int a[3][3],b[3][3],c[3][3],d[3][3];
int i,j,k;
for(i=0;i<=5;i++)
{
for(j=0;j<=5;j++)
{
for(k=0;k<=5;k++)
{
e[i][j]=e[i][j]+b[i][k]*c[k][j];
}
}
}
for(i=0;i<=5;i++)
{
for(j=0;j<=5;j++)
{
D[i][j]=a[i][j]+e[i][j];
}
}
for(i=0;i<=5;i++)
{
for(j=0;j<=5;j++)
{
printf(“%d \t”,d[i][j]);
}
printf(“\n”);
}

0 comments:

Post a Comment

Let us know your responses and feedback