//this is a program to find the subtraction of 2X2 matrices
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],b[2][2],c[2][2],i,j;
printf("\n\nEnter the values of Matrix A: ");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("\n\nEnter any number: ");
scanf("%d",&a[i][j]);
}
}
printf("\n\nEnter the values of Matrix B: ");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("\n\nEnter any number: ");
scanf("%d",&b[i][j]);
}
}
printf("\n\nThe values of Matrix C is: ");
for(i=0;i<2;i++)
{
printf("\n\n");
for(j=0;j<2;j++)
{
c[i][j]=a[i][j]-b[i][j];
printf(" %d ",c[i][j]);
}
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],b[2][2],c[2][2],i,j;
printf("\n\nEnter the values of Matrix A: ");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("\n\nEnter any number: ");
scanf("%d",&a[i][j]);
}
}
printf("\n\nEnter the values of Matrix B: ");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("\n\nEnter any number: ");
scanf("%d",&b[i][j]);
}
}
printf("\n\nThe values of Matrix C is: ");
for(i=0;i<2;i++)
{
printf("\n\n");
for(j=0;j<2;j++)
{
c[i][j]=a[i][j]-b[i][j];
printf(" %d ",c[i][j]);
}
}
getch();
}