Jan

24

#include<stdio.h>

#include<conio.h>

#define MAX 3

void main(){

int m,n,i,j;

//int const num=10;

int arr1[MAX][MAX],arr2[MAX][MAX],arr3[MAX][MAX];

printf(“Enter size of matrics as m,n: “);

scanf(“%d%d”,&m,&n);

if (m>MAX || n>MAX){

printf(“\nMatrix sizes are more than”);

printf(“declared sizes\n”);

exit(1);

}

printf(“Enter%d elements of matrix A row-wise as \n”,m*n);

for(i=0;i<m;i++){

for(j=0;j<n;j++){

scanf(“%d”,&arr1[i][j]);

}

}

for(i=0;i<m;i++){

for(j=0;j<n;j++){

scanf(“%d”,&arr2[i][j]);

}

}

for(i=0;i<m;i++){

for(j=0;j<n;j++){

arr3[i][j]=arr1[i][j]+arr2[i][j];

}

}

for(i=0;i<m;i++){

for(j=0;j<n;j++){

printf(“%d “,arr3[i][j]);

//arr2[j][i]=arr1[i][j];

}

printf(“\n”);

}

getch();

}


Leave a Reply