This is a C++ Program to check multiplicability of two matrices. Multiplicability says, if the column if the first matrix matches exactly with the row of the second matrix.
Here is source code of the C++ Program to Check Multiplicability of Two Matrices. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.
#include<conio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(int argc, char **argv)
{
cout<<"Enter the dimension of the matrix:\n ";
int rowA;cin>>rowA;
int colA;cin>>colA;
cout<<"Enter the dimension of the other matrix:\n ";
int rowB;cin>>rowB;
int colB;cin>>colB;
if(colA == rowB)
{
cout<<"Matrices are multipilcable";
}
else
{
cout<<"Matrices are not multipilcable";
}
}
Output:
$ g++ MultiplicabilityOfMatrix.cpp $ a.out Enter the dimension of the matrix: 2 4 Enter the dimension of the other matrix: 2 5 Matrices are not multipilcable Enter the dimension of the matrix: 4 5 Enter the dimension of the other matrix: 5 6 Matrices are multipilcable
Sanfoundry Global Education & Learning Series – 1000 C++ Programs.
advertisement
advertisement
Here’s the list of Best Books in C++ Programming, Data Structures and Algorithms.
If you find any mistake above, kindly email to [email protected]Related Posts:
- Apply for Computer Science Internship
- Check Programming Books
- Apply for C++ Internship
- Practice Computer Science MCQs
- Practice Programming MCQs