Ok I already got the addition part.... now my problem is the multiplication part.... can anybody pls check of whats wrong with the codes???
CODE
#include <stdio.h>
int a,b,c,d,e,i,j,l,v;
int x[50][50];
int y[50][50];
int z[50][50];
char asdf;
main()
{
printf("Enter the Size of Matrix");
printf("\nRows: ");
scanf("%d",&a);
printf("Columns: ");
scanf("%d",&b);
printf("\n");
printf("Enter Element 1: \n");
for (c=1;c<=a;c++)
{
for (d=1;d<=b;d++)
{
scanf("%d",&x[c][d]);
}
}
printf("Enter Element 2: \n");
for (c=1;c<=a;c++)
{
for (d=1;d<=b;d++)
{
scanf("%d",&y[c][d]);
}
}
printf("\n");
printf("*****Choose*****\n\n");
printf("Press 1 for Add \n");
printf("Press 2 for Multiply \n");
printf("Enter Choice: ");
scanf("%d",&l);
printf("\n");
if(l==1)
{
for (c=1;c<=a;c++)
{
for (d=1;d<=b;d++)
{
z[c][d]=x[c][d]+y[c][d];
printf ("%6d ",z[c][d]);
}
printf ("\n\n");
}
}
else
{
for (c=1;c<=a;c++)
{
for (d=1;d<=b;d++)
{
z[c][d]=0;
for(v=1;v<=b;v++);
{
z[c][d]=z[c][d]+(x[c][v]*y[v][d]);
printf("%d",&z[c][d]);
printf("\n\n");
}
}
}
}
return 0;
}