ShriRam Changed status to publish July 15, 2022
#include<stdio.h>
#include<stdio.h>
//WAP to add Subtract matrices
void main()
{
int i,j,rows,columns,a[100][100],b[100][100],Subtraction[100][100];
printf("\n Please Enter Number of rows and columns : ");
scanf("%d %d", &i, &j);
printf("\n Please Enter the First Matrix Elements : \n");
for(rows = 0; rows < i; rows++)
{
for(columns = 0;columns < j;columns++)
{
scanf("%d", &a[rows][columns]);
}
}
printf("\n Please Enter the Second Matrix Elements : \n");
for(rows = 0; rows < i; rows++)
{
for(columns = 0;columns < j;columns++)
{
scanf("%d", &b[rows][columns]);
}
}
for(rows = 0; rows < i; rows++)
{
for(columns = 0;columns < j;columns++)
{
Subtraction[rows][columns] = a[rows][columns] - b[rows][columns];
}
}
printf("\n After Subtracting Matrix a from Matrix b = a - b \n");
for(rows = 0; rows < i; rows++)
{
for(columns = 0; columns < j; columns++)
{
printf("%d \t ", Subtraction[rows][columns]);
}
printf("\n");
}
getch();
}
ShriRam Changed status to publish July 15, 2022