#include<stdio.h>
#include<conio.h>
void main()
{
int i, j, row, column, a[97][97], b[97][97], c[97][97];
clrscr();
printf("How many row and column you want enter? ");
scanf("%d", &row);
printf("How many numbers you want as column? ");
scanf("%d", &column);
printf("\nEnter numbers for matrics A\n");
for(i=0; i<row; i++)
{
for(j=0; j<column; j++)
{
printf("Enter number for row:%d and column:%d: ", i+1, j+1);
scanf("%d", &a[i][j]);
}
}
printf("\nEnter numbers for matrics B\n");
for(i=0; i<row; i++)
{
for(j=0; j<column; j++)
{
printf("Enter number for row:%d and column:%d: ", i+1, j+1);
scanf("%d", &b[i][j]);
}
}
for(i=0; i<row; i++)
{
for(j=0; j<column; j++)
{
c[i][j] = a[i][j] + b[i][j];
}
}
printf("\n\nYour Matrics Addition as below\n\n");
for(i=0; i<row; i++)
{
for(j=0; j<column; j++)
{
printf("%d+%d=%d ", a[i][j], b[i][j], c[i][j]);
}
printf("\n");
}
getch();
}
No comments:
Post a Comment