addition of two matrices
TRANSCRIPT
This program let you to add two matrices of same size and displaying the elements of resultant matrix.
void main(){ int a[2][2], b[2][2], c[2][2]; printf("enter the elements of matrix a\n"); for(i=0 ; i<=1 ; i++) { for(j=0 ; j<=1 ; j++) { scanf("%d",&a[i][j]); } }
printf("enter the elements of matrix b\n"); for(i=0 ; i<=1 ; i++) { for(j=0 ; j<=1 ; j++) { scanf("%d",&b[i][j]); } }
printf("the sum of two matrices is \n"); for(i=0 ; i<=1 ; i++) { for(j=0 ; j<=1 ; j++) { printf("%d\n",a[i][j] + b[i][j]); } }}output
enter the elements of matrix a123
4enter the elements of matrix b1234the sum of two matrices is 2468