Write a program that add & multiply two matrices.

#include<stdio.h>
#include<conio.h>

void main()
{
    int i,j,r1,c1,r2,c2,a[10][10],b[10][10],c[10][10];
    clrscr();
    printf("Enter how many row in first matrics A : ");
    scanf("%d",&r1);
    printf("Enter how many column in first matrics A : ");
    scanf("%d",&c1);
   
    for(i=0;i<r1;i++)
    for(j=0;j<c1;j++)
    scanf("%d",&a[i][j]);

    printf("Enter how many row in second matrics B : ");
    scanf("%d",&r2);
    printf("Enter how many column in second matrics B : ");
    scanf("%d",&c2);
   
    for(i=0;i<r2;i++)
    for(j=0;j<c2;j++)
    scanf("%d",&b[i][j]);

    if(r1==r2 && c1==c2)
    {
       for(i=0;i<r1;i++)
       for(j=0;j<c1;j++)
       c[i][j]=a[i][j]+b[i][j];

       printf("\nThe sum of A & B is : \n");
       for(i=0;i<r1;i++)
       {
          for(j=0;j<c1;j++)
          printf("%4d",c[i][j]);
          printf("\n\n");
      
       }
    }
   
    else
    printf("\nThe sum of A & B is impossible.");


    if(r1==r2 && c1==c2)
    {
       for(i=0;i<r1;i++)
       for(j=0;j<c1;j++)
       {
          c[i][j]=0;
          for(k=0;k<c1;k++)
          c[i][j]=c[i][j]+a[i][k]*b[k][j];
       }

       printf("\nThe multiplication of A & B is : \n");
       for(i=0;i<r1;i++)
       {
          for(j=0;j<c2;j++)
          printf("%4d",c[i][j]);
          printf("\n\n");
       }
    }
    else
    printf("\nThe multiplication of A & B is impossible.");

    getch();
}



///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........