#include<stdio.h>
#include<conio.h>
{
int a[3][3], b[3][3],s[3][3],i,j;
clrscr();
printf("\n Enter elements for matrix A\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("\nEnter the number [%d] [%d] ",i,j);
scanf("%d",&a[i][j]);
}
}
printf("\n Enter the elements for matrix B\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("\nEnter the number [%d] [%d] ",i,j);
scanf("%d",&b[i][j]);
}
}
printf("\n The sum of two matrix is\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
s[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",s[i][j]);
}
printf("\n");
}
getch();
}
No comments:
Post a Comment
Rahul-Notes