-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path1HM7.CPP
More file actions
26 lines (26 loc) · 535 Bytes
/
1HM7.CPP
File metadata and controls
26 lines (26 loc) · 535 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
// Program to add a matrix using array method.
#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 1st Matrix:\n");
for (i=1;i<=2;i++)
for (j=1;j<=2;j++)
scanf("%d",&a[i][j]);
printf("\nEnter The Elements Of 2nd Matrix:\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("\nMatrix Addition Is:\n");
for (i=1;i<=2;i++)
{
for (j=1;j<=2;j++)
printf("%d\t",sum[i][j]);
}
getch();
}