Created
November 28, 2018 18:37
-
-
Save dbc2201/83b8986827415fe21b3023c84c87050b to your computer and use it in GitHub Desktop.
Matrices Subtraction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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