Skip to content

Instantly share code, notes, and snippets.

@dbc2201
Created November 28, 2018 18:37
Show Gist options
  • Select an option

  • Save dbc2201/83b8986827415fe21b3023c84c87050b to your computer and use it in GitHub Desktop.

Select an option

Save dbc2201/83b8986827415fe21b3023c84c87050b to your computer and use it in GitHub Desktop.
Matrices Subtraction
#include<stdio.h>
void main()
{
int arr1[2][3]={{7,7,7},{8,8,8}};
int arr2[2][3]={{5,5,5},{5,5,5}};
int i,j;
printf("the first matrix is:)\n");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",arr1[i][j]);
}
printf("\n");
}
printf("the second matrix is:)\n");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",arr2[i][j]);
}
printf("\n");
}
int arr3[2][3];
printf("the matrix after substraction is:)\n");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
arr3[i][j]=arr2[i][j]-arr1[i][j];
printf("%d\t",arr3[i][j]);
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment