Here's my code:

``````#include<stdio.h>
#include<conio.h>
int main(void)
{

int a[100][100]; /* initializing matrices to '0' */
int b[100][100];
int c[100][100]; /*matrix-c for multiplication*/

/*r1,c1 are rows and coloumns for matrix-a.r2,c2 for matrix-b.*/
int r1,c1,r2,c2;
int i,j,k;
clrscr();

printf("enter the no of ROWS and COLOUMNS for MATRIX-A\n");
scanf("%d %d",&r1,&c1);
printf("enter the no of ROWS and COLOUMNS for MATRIX-B\n");
scanf("%d %d",&r2,&c2);

if(c1==r2)
{

printf("matrix multiplication possible\n\nenter numbers in MATRIX-A\n");

/* to enter numbers in matrix-a*/
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)

scanf("%d",&a[i][j]);

printf("enter numbers in MATRIX-B\n");

/* to enter numbers in matrix-b*/

for(i=0;i<r2;i++)
for(j=0;j<c2;j++)

scanf("%d",&b[i][j]);

/*for matrices multiplication*/
for(i=0;i<r1;i++)
for(j=0;j<c2;j++)
for(k=0;k<c1;k++)
*(*(c+i)+j)+=*(*(a+i)+j)*(*(*(b+k)+j));

printf("result of multiplication of matrices is \n");
/*to display as matrix format*/
for(i=0;j<r1;i++)
{
printf("\n");
for(j=0;j<c2;j++)
printf("%d\t",*(*(c+i)+j));
}

} //if

else
printf("MATRIX multiplication not Possible\n");
getch();
return 0;
}
``````

It runs but i dont get any output..:(

OK, a couple of things:
Firstly you've posted in the wrong forum. This is C code, not C++! (Not the end of the world, but FYI!)
Secondly, well done for using the code tags feature (most noobs forget this), but please remember to correctly indent your code in future as it makes it a lot easier for other users to read and understand!

In relation to your actual problem, this line looks problematic:

``````/*to display as matrix format*/
for(i=0;j<r1;i++)
``````

If I'm not mistaken, the 'j' in the break condition of the for loop should be an 'i'.
So change it to:

``````/*to display as matrix format*/
for(i=0;i<r1;i++)
``````

And that should solve your problem! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.