MATRIX SUBTRACTION IN C, SUBTRACTION OF TWO MATRIX IN C
#inclue<stdio.h>
#include<conio.h>
void main()
{
int a[2][3], b[2][3], c[2][3], i, j;
printf(“Enter values for A:\n”);
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
scanf(“%d”,&a[i][j]);
}}
printf(“Enter values for B:\n”);
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
scanf(“%d”,&b[i][j]);
}}
// Loops to perform addition matrix array
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
c[i][j]= a[i][j] - b[i][j];
}}
printf("Matrix Array Subtraction")
printf("Matrix Array Subtraction")
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
printf(“\n%d”, c[i][j]);
}}
getch();
}
----------------------------
OUTPUT
----------------------------
Enter values for A:
8
9
5
6
4
7
Enter values for B:
3
4
3
5
2
4
Matrix Array Addition
5
5
2
1
2
3
----------------------------
OUTPUT
----------------------------
Enter values for A:
8
9
5
6
4
7
Enter values for B:
3
4
3
5
2
4
Matrix Array Addition
5
5
2
1
2
3
0 Comments