#include<stdio.h>
#include<conio.h>
main()
{
int a[4][4],b[4][4],c[4][4],i,j;
clrscr();
printf("enter the elements of matrix a\n");
for(i=0;i<=3;i++)
for(j=0;j<=3;j++)
scanf("%d",&a[i][j]);
printf("\nthe first matrix is::=>\n");
for(i=0;i<=3;i++)
{
printf("\n");
for(j=0;j<=3;j++)
printf("%d",a[i][j]);
}
printf("\nEnter the elements of second matrix\n");
for(i=0;i<=3;i++)
for(j=0;j<=3;j++)
scanf("%d",&b[i][j]);
printf("\nthe second matrix is::\n");
for(i=0;i<=3;i++)
{
printf("\n");
for(j=0;j<=3;j++)
printf("%d",b[i][j]);
}
for(i=0;i<=4;i++)
for(j=0;j<=4;j++)
c[i][j]=a[i][j] + b[i][j];
printf("\nthe addition of matrix is\n");
for(i=0;i<=3;i++)
{
for(j=0;j<=3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
getch();
}
#include<conio.h>
main()
{
int a[4][4],b[4][4],c[4][4],i,j;
clrscr();
printf("enter the elements of matrix a\n");
for(i=0;i<=3;i++)
for(j=0;j<=3;j++)
scanf("%d",&a[i][j]);
printf("\nthe first matrix is::=>\n");
for(i=0;i<=3;i++)
{
printf("\n");
for(j=0;j<=3;j++)
printf("%d",a[i][j]);
}
printf("\nEnter the elements of second matrix\n");
for(i=0;i<=3;i++)
for(j=0;j<=3;j++)
scanf("%d",&b[i][j]);
printf("\nthe second matrix is::\n");
for(i=0;i<=3;i++)
{
printf("\n");
for(j=0;j<=3;j++)
printf("%d",b[i][j]);
}
for(i=0;i<=4;i++)
for(j=0;j<=4;j++)
c[i][j]=a[i][j] + b[i][j];
printf("\nthe addition of matrix is\n");
for(i=0;i<=3;i++)
{
for(j=0;j<=3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
getch();
}
No comments:
Post a Comment