Write a C program to add & subtract two same size matrices
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
int a[50][50],b[50][50],c[50][50],i,j,row,col;
printf("Enter how many row number you want= ");
scanf("%d",&row);
printf("Enter how many col number you want= ");
scanf("%d",&col);
//First Matrix Input
for(i=0;i<row;i++)
for(j=0;j<col;j++)
scanf("%d",&a[i][j]);
//Second Matrix Input
for(i=0;i<row;i++)
for(j=0;j<col;j++)
scanf("%d",&b[i][j]);
//Calculation addition
for(i=0;i<row;i++)
for(j=0;j<col;j++)
c[i][j]=a[i][j]+b[i][j];
clrscr();
printf("Firat Matrix=\n");
for(i=0;i<row;i++)
{
printf("| ");
for(j=0;j<col;j++)
printf("%d ",a[i][j]);
printf("|\n");
}
printf("\nSecond Matrix=\n");
for(i=0;i<row;i++)
{
printf("| ");
for(j=0;j<col;j++)
printf("%d ",b[i][j]);
printf("|\n");
}
printf("\nOutput addition= \n");
for(i=0;i<row;i++)
{
printf("| ");
for(j=0;j<col;j++)
printf("%d ",c[i][j]);
printf("|\n");
}
//Calculation Subtraction
for(i=0;i<row;i++)
for(j=0;j<col;j++)
c[i][j]=a[i][j]-b[i][j];
printf("\nOutput Subtraction= \n");
for(i=0;i<row;i++)
{
printf("| ");
for(j=0;j<col;j++)
printf("%d ",c[i][j]);
printf("|\n");
}
getch();
}