theme

" जीतने वाले छोड़ते नहीं और छोड़ने वाले जीतते नही "

Friday, May 21, 2010

matrix multipication

#include main() { int a[3][3],b[3][3],c[3][3],d[3][3],i,j,k,m=2,n=2; printf("enter the values of matrix a\n"); for(i=0;i<2;i++) for(j=0;j<2;j++) scanf("%d",&a[i][j]); printf("enter the values of matrix b\n"); for(i=0;i<2;i++) for(j=0;j<2;j++) scanf("%d",&b[i][j]); printf("addition of a and b matrix is\n"); for(i=0;i<2;i++) for(j=0;j<2;j++) c[i][j]=a[i][j]+b[i][j]; for(i=0;i<2;i++) for(j=0;j<2;j++) printf("%d\n",c[i][j]); printf("MATRIC MULTIPICATION of a and b matrix is\n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { c[i][j]=0; for(k=0;k<2;k++) { c[i][j]+=a[i][k]*b[k][j]; } printf("%d\t",c[i][j]); } }

No comments:

Post a Comment