3/*Program for addition of two matrix using array*/


#include<conio.h>
#include<stdio.h>
void main()
{
int a[3][3],i,j,b[3][3],sum[3][3];
clrscr();
printf(“\nEnter first nine value\n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf(“%d”,&a[i][j]);
}
printf(“\nEnter the second nine value\n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf(“%d”,&b[i][j]);
}
printf(“\n Given first matrix is\n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf(“%d\t”,a[i][j]);
printf(“\n”);
}
printf(“\n Given second matrix is\n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf(“%d\t”,b[i][j]);
printf(“\n”);
}
printf(“\n Given addition matrix is\n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
sum[i][j]=a[i][j]+b[i][j];
printf(“%d\t”,sum[i][j]);
}
printf(“\n”);
}
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s