forked from MadhavBahl/OOPS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharraySum.c
33 lines (31 loc) · 875 Bytes
/
arraySum.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* ======================================= */
/* ===== Multi Dimensional Array Sum ===== */
/* ======================================= */
#include<stdio.h>
int main() {
int i,r,c,j,A[100][100],B[100][100],sum[100][100];
printf("Enter the number of rows: ");
scanf("%d",&r);
printf("Enter the number of columms: ");
scanf("%d",&c);
printf("Enter the %d Elements of matrix A: \n",r*c);
for(i=0;i<r;i++) {
for(j=0;j<c;j++)
scanf("%d",&A[i][j]);
}
printf("Enter the %d Elements of matrix B: \n",r*c);
for(i=0;i<r;i++) {
for(j=0;j<c;j++){
scanf("%d",&B[i][j]);
sum[i][j] = A[i][j]+B[i][j];
}
}
printf("Your The sum of matrix is: \n");
for(i=0;i<r;i++) {
for(j=0;j<c;j++)
{
printf("%d ",sum[i][j]);
}
printf("\n");
}
}