C Program to Multiply any Two 3 X 3 Matrices

C Program to Multiply Two 3 X 3 Matrices

This page has a C Program to Multiply any Two 3 X 3 Matrices. It is clear that, this C program will Multiply any Two 3 X 3 Matrices. To multiply any two matrices, the number of columns of the first matrix must be equal to the number of rows  of the the second matrix. If the size of A matrix is (3 x 4), and the size of B matrix is (4 x 2), then the two matrices can be multiplied. If the size of A matrix is (3 x 2), and the size of B matrix is (4 x 2), then the two matrices can not be multiplied. For multiplying any two matrices, the two matrices must be compatible. The below given C program will find the product (Multiply) of any Two 3 X 3 Matrices. Kindly check out the program to Multiply any Two 3 X 3 Matrices. The Questions for the matrix multiplication program can be . . .

1). C program to Multiply any Two 3 X 3 Matrices.    

2). C program to find the product of any Two 3 X 3 Matrices.   

3). C program to Multiply one 3 x 3 matrix with other on same size.    

4). C program to find the product of any Two Matrices with size 3 x 3.  

5). C program to find the product of Two 3 X 3 Matrices.  

6). C program to find the product of Two Matrices.  

7). C program to multiply Two 3 X 3 Matrices.  

8). C program to multiply Two Matrices.

Matrix multiplication Program


   #include<stdio.h>
   int main(){
           int mat31[10][10], mat32[10][10], mult[10][10];
           int i, j, k;
           printf("\n Enter the First Matrix elements : \n"); // Read 1st Matrix
           for (i = 1; i <= 3; i++){
           for (j = 1; j <= 3; j++){
           scanf("%d", &mat31[i][j]);
          }
          }
          printf("\n Enter the Second Matrix elements : \n"); // Read 2nd Matrix
          for (i = 1; i <= 3; i++){
           for (j = 1; j <= 3; j++){
           scanf("%d", &mat32[i][j]);
           }
           }
           printf("\n The First Matrix :  \n\n"); // Print 1st Matrix
           for (i = 1; i <= 3; i++){
           for (j = 1; j <= 3; j++){
           printf("\t %d ", mat31[i][j]);
           }
           printf("\n");
           }
           printf("\n The Second Matrix :  \n\n"); // Print 2nd Matrix
           for (i = 1; i <= 3; i++){
           for (j = 1; j <= 3; j++){
           printf("\t %d ", mat32[i][j]);
           }
           printf("\n");
           }

   // . . . The two matrices have been multipled here . . .

          for (i = 1; i <= 3; i++){
          for (j = 1; j <= 3; j++){
          mult[i][j] = 0;
          for (k = 1; k <= 3; k++){
          mult[i][j] = mult[i][j]+ mat31[i][k] * mat32[k][j];
          }
          }
          }

  // . . . Product of the given two Matrices is displayed in Matrix form . . .

         printf("\n\n The Resultant of  Matrix Multiplication is \n\n");
         for (i = 1; i <= 3; i++){
         for (j = 1; j <= 3; j++){
         printf("\t%d", mult[i][j]);
         }
         printf("\n");
         }
         return (0);
         }


Enter the First Matrix elements :  
2      2      2      2      2      2      2      2      2
Enter the Second Matrix elements :  
2      2      2      2      2      2      2      2      2


The First Matrix :

2           2           2

2           2           2

2           2           2

The Second Matrix :

2           2           2

2           2           2

2           2           2

The Resultant of  Matrix Multiplication is 

12           12           12

12           12           12

12           12           12



Related Popular Posts:


*  Write a c program to check whether a given number is prime number or not?

 

*  Write a C program to find the prime numbers between 1 and 100

 

*  Write a C program to display the prime numbers between a range ?

 

*  Write a C program to find the prime numbers between a range using while loop?

 

*  Write a C program to find the sum of prime numbers between a range 

About Er. T.Tharesh Kumar

I am a Professor and Head of Department of Computer Science in an Arts and Science College. I have designed this website to provide solved example programs of different categories for all the school and college going students to learn C language deeply, and to practice Interview based Multiple Choice (Objective Type) questions and answers.

Other Related C Programs :


* C Program to find whether the given number is Odd or Even

* C Program to find the Sum of Odd Digits

* C Program to find the Sum of Even Digits

* C Program to find the Sum of Even and Odd Digits,

* C Program to Display Odd digits

* C Program to Display even digits

* C Program to Display Odd Numbers,

* C Program to Display Even Numbers,

* C Program to Check whether the given number is Armstrong number

* C Program to display the Armstrong numbers in Range

* C Program to display the Armstrong numbers between 1 and 1000

* C Program to check perfect number, perfect numbers in range

* C Program to Check Prime number, Prime numbers between 1 and 100

* C Program to display the Prime numbers in a Range

* C Program to display the Sum of Prime numbers

* C Program to Check Strong number

* C Program to display the Strong number in Range

* C Program to Check whether the given number is polindrome number or not

* C Program to Check polindrome number using for loop

* C Program to Check polindrome number using Recursion

* C Program to  check whether the given string is polindrome or not

* C Program to find the Roots of Quadratic equation

* C Program to display Fibonacci Series

* C Program to display the Fibonacci Series using an array

* C Program to display the Fibonacci Series using while loop

* C Program to find the Sum of Fibonacci Series, Factorial of Number

* C Program to find the Factorial without using Recursion

* C Program to find the Factorial using Pointers

* C Program to find the Factorial using Function

Bookmark and Share