C Saved Program: serene-dog

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


#include <stdio.h>

int main(void) {
   int a[10][10], b[10][10], c[10][10], i, j, k;
   int sum = 0;
 
   printf("\nEnter First Matrix : n");
   for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
         scanf("%d", &a[i][j]);
      }
   }

   printf("The First Matrix is: \n");
   for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
         printf(" %d ", a[i][j]);
      }
      printf("\n");
   }
   printf("Enter the second matrix:\n");
   for(i = 0 ; i < 3 ; i++)
   {
       for(j = 0 ; j < 3 ; j++)
       {
           scanf("%d", &b[i][j]);
       }
   }
   for(i=0 ; i<3 ; i++)
   {
       for(j=0 ; j<3 ; j++)
       {
           printf(" %d ", b[i][j]);
       }
       printf(" \n ");
   }
   printf("multiplication of two matrices is:\n");
   for(i=0 ; i<3 ; i++)
   {
       for(j=0 ; j<3 ; j++)
       {
           for(k=0 ; k<3 ; k++)
           {
               sum=sum + (a[i][k]*b[k][j]);
           }
           c[i][j]=sum;
       }
      
   }
	printf("the result is:\n");
	for(i=0 ; i<3 ; i++)
	{
	    for(j=0 ; j<3 ; j++)
	    {
	        printf(" %d ", c[i][j]);
	    }
	    printf(" \n ");
	}
	printf("This is the online C/C++ compiler");
	return 0;
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs