-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMATRIX.CPP
More file actions
27 lines (27 loc) · 534 Bytes
/
MATRIX.CPP
File metadata and controls
27 lines (27 loc) · 534 Bytes
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
/* WAP TO ADD MATRIX USING ARRAY */
#include<stdio.h>
#include<conio.h>
main()
{
int a[4][4], b[4][4], sum[4][4],i,j;
clrscr();
printf("Enter the elements of first matrix \n");
for(i=1;i<=2;i++)
for(j=1;j<=2;j++)
scanf("%d", &a[i][j]);
printf("Enter the elements of second matrix x \n");
for(i=1;i<=2;i++)
for(j=1;j<=2;j++)
scanf("%d", &b[i][j]);
for(i=1;i<=2;i++)
for(j=1;j<=2;j++)
sum[i][j]=a[i][j]+b[i][j];
printf("Added matrix is \n");
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
printf("%d\t", sum[i][j]);
printf("\n");
}
getch();
}