Code:

//Matrix Calculator//
#include <stdio.h>
#include <conio.h>
typedef float matrix[50][50];
void takematrix (char name, matrix box, int rows, int cols)
{
int i , j;
printf("For Matrix %c :\n", name);
for (i=1; i<=rows; i++)
{
for (j=1; j<=cols; j++)
{
printf("Enter %c(%dx%d) :", name, i, j);
scanf("%f", &box[i][j]);
}
}
}
void showmatrix (char name, matrix box, int rows, int cols)
{
int i, j;
printf("Matrix %c :\n", name);
for (i=1; i<=rows; i++)
{
for (j=1; j<=cols; j++)
{
printf("%6.2f ", box[i][j]);
}
printf("\n");
}
}
void addmatrix(matrix box1, matrix box2, matrix box3, int rows, int cols )
{
int i, j;
for (i=1; i<=rows; i++)
{
for (j=1; j<=cols; j++)
{
box3[i][j]=box1[i][j]+box2[i][j];
}
}
}
void submatrix(matrix box1, matrix box2, matrix box3, int rows, int cols)
{
int i, j;
for (i=1; i<=rows; i++)
{
for (j=1; j<=cols; j++)
{
box3[i][j]=box1[i][j]-box2[i][j];
}
}
}
void multmatrix(matrix box1, matrix box2, matrix box3, int rows1, int rows2, int cols2)
{
int i, j, k;
for (i=1; i<=rows1; i++)
{
for (j=1; j<=cols2; j++)
{
box3[i][j]=0;
for (k=1; k<=rows2; k++)
{
box3[i][j]=box3[i][j]+(box1[i][k])*(box2[k][j]);
}
}
}
}
main()
{
clrscr();
int rowsa, colsa, rowsb, colsb, i, j;
matrix A, B, C, D, E;
char a, b, c, d, e;
a='A';
b='B';
c='C';
d='D';
e='E';
clrscr();
printf("Matrix Calculator\n");
printf("Programmed By Mahurshi Akilla\n");
printf("http://mahurshi.tripod.com\n\n\n");
printf("Enter order of matrix A (e.g. 3x5) : ");
scanf("%dx%d", &rowsa, &colsa);
printf("Enter order of Matrix B (e.g. 5x4) : ");
scanf("%dx%d", &rowsb, &colsb);
printf("\n");
takematrix(a, A, rowsa, colsa);
printf("\n");
takematrix(b, B, rowsb, colsb);
printf("\n");
clrscr();
showmatrix(a, A, rowsa, colsa);
showmatrix(b, B, rowsb, colsb);
if (rowsa==rowsb && colsa==colsb)
{
addmatrix(A, B, C, rowsa, colsa);
showmatrix(c, C, rowsa, colsa);
printf("Where Matrix C = A+B\n");
submatrix(A, B, D, rowsa, colsa);
showmatrix(d, D, rowsa, colsa);
printf("Where Matrix D = A-B\n");
}
else
{
printf("\n");
printf("Addition and Subtraction Could Not Be Carried Out.\n");
printf("Matrices 'C=A+B' and 'D=A-B' Do Not Exist\n");
printf("\n");
}
if (colsa==rowsb)
{
multmatrix(A, B, E, rowsa, rowsb, colsb);
showmatrix(e, E, rowsa, colsb);
printf("Where Matrix E = A x B\n");
}
else
{
printf("\n");
printf("Multiplication Could Not Be Carried Out.\n");
printf("Matrix 'E = A * B' Does Not Exist.\n");
}
getchar();
getchar();
}

Hope this helps!