Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int a[10][10],b[10][10],m,n,o,p,i,j;
- printf("\nEnter the row and column of first matrix");
- scanf("%d %d",&m,&n);
- printf("\nEnter the row and column of second matrix");
- scanf("%d %d",&o,&p);
- printf("\nEnter the First matrix->");
- for(i=0;i<m;i++){
- for(j=0;j<n;j++){
- scanf("%d",&a[i][j]);}}
- printf("\nEnter the Second matrix->");
- for(i=0;i<o;i++){
- for(j=0;j<p;j++){
- scanf("%d",&b[i][j]);}}
- printf("\nThe First matrix is\n");
- for(i=0;i<m;i++){
- printf("\n");
- for(j=0;j<n;j++){
- printf("%d\t",a[i][j]);
- }
- }
- printf("\nThe Second matrix is\n");
- for(i=0;i<o;i++){
- printf("\n");
- for(j=0;j<p;j++){
- printf("%d\t",b[i][j]);
- }
- }
- printf("\n The sub of two matrix is \n");
- for (i=0 ; i<m ; i++)
- {
- printf("\n");
- for (j=0 ; j<n ;j++)
- {
- int sub=0 ;
- sub = a[i][j] - b[i][j];
- printf("%d ",sub);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement