-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrix_sub.c
More file actions
44 lines (40 loc) · 908 Bytes
/
matrix_sub.c
File metadata and controls
44 lines (40 loc) · 908 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<stdio.h>
void main()
{
int A[100][100],B[100][100],sub[100][100],m,n,i,j;
printf("Enter order of matrix (row _ column) :\t");
scanf("%d%d",&m,&n);
printf("Enter Elements of first matrix\t:");
for ( i = 0; i < m; i++)
{
for ( j = 0; j < n; j++)
{
scanf("%d",&A[i][j]);
}
}
printf("Enter Elements of Second matrix\t:");
for ( i = 0; i < m; i++)
{
for ( j = 0; j < n; j++)
{
scanf("%d",&B[i][j]);
}
}
for ( i = 0; i <m; i++)
{
for ( j = 0; j < n; j++)
{
sub[i][j]=A[i][j]-B[i][j];
}
}
printf("SUB OF GIVEN MATRIX ARE:\n");
for ( i = 0; i < m; i++)
{
printf("\n");
for ( j = 0; j < n; j++)
{
printf("%d\t",sub[i][j]);
}
}
printf("\n");
}