write a program addition of matrix.
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],b[2][2],c[2][2],col,row;
clrscr();
for(row=0;row<2;row++){
for(col=0;col<2;col++){
printf("input the data in metrix1:");
scanf("%d",&a[row][col]);
}
}
for(row=0;row<2;row++){
for(col=0;col<2;col++){
printf("input the data in metrix2:");
scanf("%d",&b[row][col]);
}
}
for(row=0;row<2;row++){
for(col=0;col<2;col++){
c[row][col]=a[row][col]+b[row][col];
}
}
for(row=0;row<2;row++){
for(col=0;col<2;col++) {
printf("\t%d",c[row][col]);
}
printf("\n");
}
getch();
}
Comments
Post a Comment