#include<stdio.h>//header file
#include<conio.h>//header file
void main() //starting of the main() function
{
int a[3][4],b[3][4],c[3][4],i,j,c1,c2,r1,r2; //declaration of the variables
clrscr();
printf("program for adding two 3*4 matrices");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter the elements in the first matrix");//taking input from the user
printf("\n");
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
printf("a[%d][%d] :->",i,j);
scanf("%d",&a[i][j]);
}
}
printf("\n\n");
printf("\n\nenter the elements in the second matrix");//taking input from the user
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
printf("b[%d][%d] :->",i,j);
scanf("%d",&b[i][j]);
}
}
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe required matrix after addition is=");
printf("\n\n");
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("\tc[%d][%d] :->%d",i,j,c[i][j]); //printing output
}
printf("\n");
}
getch();
}