-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path1HM9.CPP
More file actions
29 lines (29 loc) · 598 Bytes
/
1HM9.CPP
File metadata and controls
29 lines (29 loc) · 598 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
28
29
#include<stdio.h>
#include<conio.h>
main()
{
int a[4][4], b[4][4], sum[4][4],i,j,t;
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("\nEnter 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("\nAdded matrix is \n");
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
printf("%d\t", sum[i][j]);
printf("\n");
}
printf("\n\nPress (t) To Do Transpose Of Obtained Matrtix: ");
scanf("%d",&t);
if (t==t)
b[i][j]=a[j][i];
getch();
}