Write a program to declare two matrices in your program. Obtain matrix C=A+B and print it
A=2 1 3 7 6 B= 0 1 2 3 4
8 13 4 0 1 9 1 2 6 7
1 2 3 4 3 4 0 3 7 1
/* A program to declare two matrix in your program. obtain C=A+B and print it
programmed by:
name: Jitendra Kr yadav
Roll: 16
date: 21 march 2011*/
#include <stdio.h>
#include <conio.h>
void main()
{
int i,j;
int a[3][5]= {{2,1,3,7,6},
{8,13,4,0,1},
{1,2,3,4,3}
};
int b[3][5]= {{0,1,2,3,4},
{9,1,2,6,7},
{4,0,3,7,1}
};
int c[3][5];
for(i=0; i<3; i++)
{
for(j=0; j<5; j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
for(i=0; i<3; i++)
{
printf(“\n”);
for(j=0; j<5; j++)
printf(“%d\t”,c[i][j]);
}
getch();
}