#include <stdio.h>
#include<conio.h>
void main()
{
int i,j,k,a[3][3],b[3][3],c[3][3];
printf("Enter the element 1st matrix\n");
for ( i = 0 ; i < 3 ; i++ )
for ( j = 0 ; j < 3 ; j++ )
scanf("%d", &a[i][j]);
printf("Enter the element 2nd matrix\n");
for ( i = 0 ; i < 3 ; i++ )
for ( j = 0 ; j < 3; j++ )
scanf("%d", &b[i][j]);
for ( i = 0 ; i< 3 ; i++ )
for ( j= 0 ; j < 3 ; j++ )
c[i][j] = a[i][j] + b[i][j];
printf("Sum of the matrices:-");
for ( i = 0 ; i < 3 ; i++ )
{
for ( j = 0 ; j< 3 ; j++ )
printf("%d\t", c[i][j]);
printf("\n");
}
}
#include<conio.h>
void main()
{
int i,j,k,a[3][3],b[3][3],c[3][3];
printf("Enter the element 1st matrix\n");
for ( i = 0 ; i < 3 ; i++ )
for ( j = 0 ; j < 3 ; j++ )
scanf("%d", &a[i][j]);
printf("Enter the element 2nd matrix\n");
for ( i = 0 ; i < 3 ; i++ )
for ( j = 0 ; j < 3; j++ )
scanf("%d", &b[i][j]);
for ( i = 0 ; i< 3 ; i++ )
for ( j= 0 ; j < 3 ; j++ )
c[i][j] = a[i][j] + b[i][j];
printf("Sum of the matrices:-");
for ( i = 0 ; i < 3 ; i++ )
{
for ( j = 0 ; j< 3 ; j++ )
printf("%d\t", c[i][j]);
printf("\n");
}
}
No comments :
Post a Comment