Created
August 4, 2017 18:24
-
-
Save sudikrt/2a77ab58440ba01ebb6cae729d8e8e2a to your computer and use it in GitHub Desktop.
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> | |
main() | |
{ | |
int m,n,m1,n1,i,j,k,a[10][10],b[10][10],r[10][10]; | |
printf("\nEnter the first matrix row & coloumn size:"); | |
scanf("%d%d",&m,&n); | |
printf("Enter the matrix element:"); | |
i=0; | |
r1:if(i<m) | |
{ | |
j=0; | |
c1:if(j<n) | |
{ | |
scanf("%d",&a[i][j]); | |
j++; | |
goto c1; | |
} | |
i++; | |
goto r1; | |
} | |
printf("\nEnter the second matrix row & coloumn size:"); | |
scanf("%d%d",&m1,&n1); | |
if(n==m1) | |
{ | |
printf("Enter the matrix element:"); | |
i=0; | |
r2:if(i<m1) | |
{ | |
j=0; | |
c2:if(j<n1) | |
{ | |
scanf("%d",&b[i][j]); | |
j++; | |
goto c2; | |
} | |
i++; | |
goto r2; | |
} | |
} | |
else | |
{ | |
printf("\nError! column of first matrix not equal to row of second matrix.\n\n"); | |
exit(0); | |
} | |
i=0; | |
r3:if(i<m) | |
{ | |
j=0; | |
c3:if(j<n1) | |
{ | |
r[i][j]=0; | |
k=0; | |
k3:if(k<m1) | |
{ | |
r[i][j]=r[i][j]+a[i][k]*b[k][j]; | |
k++; | |
goto k3; | |
} | |
j++; | |
goto c3; | |
} | |
i++; | |
goto r3; | |
} | |
printf("\nMultiplied matrix element:\n"); | |
i=0; | |
r4:if(i<m) | |
{ | |
j=0; | |
c4:if(j<n1) | |
{ | |
printf("%d\t",r[i][j]); | |
j++; | |
goto c4; | |
} | |
i++; | |
printf("\n"); | |
goto r4; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment