//program to get difference of two matrices of order mxn
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics_1[100][100],matrics_2[100][100];
int i,j;
int total_row,total_col;
printf("enter total number of rows(m)\n");
scanf("'%d",&total_row);
printf("'enter total columns(n)\n");;
scanf("%d",&total__col);
printf("enter elements of first matrix\n");
for(i=0;i<total_row;i++)
{
for(j=0;j<total_col;j++)
{
scanf("%d",&matrics_1[i][j]);
}
}
printf("now enter for second matrix\n");
for(i=0;i<total_row;i++)
{
for(j=0;j<total_col;j++)
{
scanf("%d",&matrics_2[i][j]);
}
}
printf("the summed matrix is\n");
for(i=0;i<total_row;i++)
{
for(j=0;j<total_col;j++)
{
printf("%d",matrics_1[i][j]-matrics_2[i][j]);
}
printf(\n");
}
getch();
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics_1[100][100],matrics_2[100][100];
int i,j;
int total_row,total_col;
printf("enter total number of rows(m)\n");
scanf("'%d",&total_row);
printf("'enter total columns(n)\n");;
scanf("%d",&total__col);
printf("enter elements of first matrix\n");
for(i=0;i<total_row;i++)
{
for(j=0;j<total_col;j++)
{
scanf("%d",&matrics_1[i][j]);
}
}
printf("now enter for second matrix\n");
for(i=0;i<total_row;i++)
{
for(j=0;j<total_col;j++)
{
scanf("%d",&matrics_2[i][j]);
}
}
printf("the summed matrix is\n");
for(i=0;i<total_row;i++)
{
for(j=0;j<total_col;j++)
{
printf("%d",matrics_1[i][j]-matrics_2[i][j]);
}
printf(\n");
}
getch();
No comments:
Post a Comment