### Program to multiply the given two matrices

Updated on November 05, 2014     VIKRAM     2111

### Program:

```#include<stdio.h>
#include<conio.h>
void main()
{
int mata[10][10], matb[10][10], matc[10][10] ;
int i, j, k, row1, col1, row2, col2 ;
clrscr() ;
printf("Enter the order of first matrix : ") ;
scanf("%d %d", &row1, &col1) ;
printf("\nEnter the order of second matrix : ") ;
scanf("%d %d", &row2, &col2) ;
if(col1 == row2)
{
printf("\nEnter the elements of first matrix : \n\n") ;
for(i = 0 ; i < row1 ; i++)
for(j = 0 ; j < col1 ; j++)
scanf("%d", &mata[i][j]) ;
printf("\nEnter the elements of second matrix : \n\n") ;
for(i = 0 ; i < row2 ; i++)
for(j = 0 ; j < col2 ; j++)
scanf("%d", &matb[i][j]) ;
for(i = 0 ; i < row1 ; i++)
{
for(j = 0 ; j < col2 ; j++)
{
matc[i][j] = 0 ;
for(k = 0 ; k < col1 ; k++)
matc[i][j] = matc[i][j] + mata[i][k] * matb[k][j] ;
}
}
printf("\nThe resultant matrix is : \n\n") ;
for(i = 0 ; i < row1 ; i++)
{
for(j = 0 ; j < col2 ; j++)
{
printf("%d \t", matc[i][j]) ;
}
printf("\n") ;
}
}
else
printf("\nMatrix Multiplication is not possible ...") ;
getch() ;
}```

### Output:

Case: 1

```Enter the order of first matrix : 3 3
Enter the order of second matrix : 3 3
Enter the elements of first matrix :
1 1 1
1 1 1
1 1 1
Enter the elements of second matrix :
1 1 1
1 1 1
1 1 1
The resultant matrix is :
3 3 3
3 3 3
3 3 3```

Case: 2

```Enter the order of first matrix : 3 3
Enter the order of second matrix : 2 2
Matrix Multiplication is not possible ...```

Related Programs

Swapping two numbers (using two variables)

Swapping two numbers (using three variables)

Performing arithmetic operations using `switch...case`

Program to print the multiplication table

Finding the number of 500, 100, 50, 20, 10, 5, 2, 1

Printing addition table of the given number

Program to print the multiplication table

Finding the biggest of 3 numbers using `if...else`

Biggest of 3 numbers using `ternary operator`

To find the average of first n natural numbers

To count the number of digits in an integer

Program to find the sum of digits of an integer

Print the numbers that are divisible by a given no.

To print all the divisors of a given number

Program for reversing an integer

Program to find the sum of odd and even numbers

Program to find the sum of `fibonacci series`

Program to find the day of the given date

To find whether the given number is even or odd

To check whether the person is in teen age or not

Check whether the person is eligible to vote or not

To find the given no. is perfect no. (or) not

To find the given no. is perfect square (or) not

To check whether the given no. is `prime` (or) not

To find the given number is `armstrong` (or) not

To display only the positive elements of the array

To display only the negative elements of the array

To find the sum of VE & -VE elements in an array

Program to read and reverse an array

Program to find the `factorial` of a given number

Program to find NCR value of the given numbers

Program to find the value of `xn`

Program to find `LCM `and `GCD `of the given two numbers

Program to find the roots of a quadratic equation

Simultaneous equation using `gauss elimination method`

To convert temperature in `centigrade to farenheit`

To convert temperature in `farenheit to centigrade`

To convert the given number (1 to 10) to characters

Program to change an integer to words

To convert a decimal number to a binary number

To convert a binary number to a decimal number

Program to calculate the `cosine` series

Program to calculate the `sine` series

Program to calculate the `exponential` series

Program to generate `Floyd's triangle`

Program to generate `Pascal's triangle`

Program to generate `Trigonometric Table`

Program to generate `permutation`

Program to generate magic square

Program to generate odd and even numbers

Program to generete `fibonacci series`

Program to generate `prime numbers`

Program to generate `armstrong numbers`

To find sum of all the elements of the given `matrix`

Find sum of diagonal elements of the given `matrix`

Find smallest & biggest elements of the given `matrix`

Find the sum of upper & lower traiangular elements

To find the given matrix is a `unit matrix` (or) not

To find the given matrix is a `unit matrix` (or) not - 2

Program to transpose the given `matrix`

Program to add the given two matrices

Program to subtract the given two matrices

Program to multiply the given two matrices

Program to print the alphabets with `ASCII` values

To check the given character is `vowel` (or) not

Program to find the length of the given string

To find a character is no./letter/special character

To convert uppercase characters to lowercase

Counting vowels, consonants, digits, special & words

Program to `concatenate` the given two strings

Perform string manipulation using string functions

To count no. of occurence of a character in a string

Program to `reverse` the given string

To check the given string is `palindrome` (or) not

To `sort` the given strings in alphabetical order

Program to maintain student details using `structures`

Program to maintain employee details using `structures`

To find the length of the string using `pointers`

To copy one string to another using `pointers`

Concatenate the given two strings using `pointers`

To compare the given two string using `pointers`

Program to write and read data from a `file`

Read integers and store odd & even no. in a `file`

Program to maintain student details using files

Program to maintain employee details using files

Program to `merge` the contents of two `files`

Program to `encrypt and decrypt` a `file`

Program to search an element using `binary search`

Program to search an element using `linear search`

Program to sort the given numbers using `bubble sort`

To sort the given numbers using `selection sort`

To sort the given numbers using `insertion sort`

Program to sort the given numbers using `quick sort`

Program to sort the given numbers using `shell sort`

To sort the given numbers in `ascending & descending order`

Implentation of `stack` using `arrays`

Implentation of `queue` using `arrays`

Find the root of a equation using `Bisection method`

Find the root of a equation using `Newton Raphson`

To find the root of a equation using `Secant Method`