multiplication of matrices with compatibility check, C/C++ Programming

Assignment Help:

 

WAP in C for multiplication of matrices with compatibility Check

#include

#include

void main()

{

                long int m1[10][10],m2[10][10],i,j,mult[10][10],r1,c1,r2,c2;

                printf("enter order of matrix 1:\n\n");

                scanf("%d %d",&r1,&c1);

                printf("enter order of matrix 2:\n\n");

                scanf("%d %d",&r2,&c2);

                if(c1==r2)

                {

                                printf("Enter element of matrix 1:\n\n");

                                for(i=0;i

                                                for(j=0;j

                                                {

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

                                                }

                                                printf("\nEnter elements of Martix 2:\n\n");

                                                for (i=0;i

                                                                for(j=0;j

                                                                {

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

                                                                }

                                                               

                                                                printf("\n Matrix 1:\n\n\n");

                                                                for(i=0;i

                                                                {

                                                                                for(j=0;j

                                                                                                printf("\t%d",m1[i][j]);

                                                                                printf("\n");

                                                                }

 

                                                                printf("\n matrix 2:\n\n");

                                                                for(i=0;i

                                                                {

                                                                                for(j=0;j

                                                                                                printf("\t%d",m2[i][j]);

                                                                                printf("\n");

                                                                }

                                                                printf("\n Multiplicfation Of Matrices\n\n");

                                                // for matrix multiplication

                                                for(i=0;i

                                                {

                                                                for(j=0;j

                                                                {             

                                                                                mult[i][j]=0;

                                                                                for(long int k=0;k<=r1;k++)

                                                                                {

                                                                                                mult[i][j]+=m1[i][k]*m2[k][j];

                                                                                }

                                                                                printf("\t%d",mult[i][j]);

                                                                }

                                                                printf("\n");

                                                }

                                               

                }

else

printf("\n Multiplication is not possible with the order of matrices\n\n");

}

OUTPUT

 

 

 

1458_multiplication of matrices with compatibility Check.png


Related Discussions:- multiplication of matrices with compatibility check

Explain the command line parameters, Explain the Command Line Parameters? ...

Explain the Command Line Parameters? The Command line arguments are parameters supplied to a program from the operating system. These arguments are parameters accepted to main

Nested if else, input marks of c and c++ if c grater than equal to 50 grate...

input marks of c and c++ if c grater than equal to 50 grater than 50 you are pass if c greater than equal to 50 c++ less than 50 than supplementry c++ if c less then 50 and c++ gra

Assignment, Write a program that computes the cost of a long distance call....

Write a program that computes the cost of a long distance call. The cost of the call is determined according to the following rate schedules. a. A call made between 8:00 AM and

Define the bitwise-exclusive-or operator, Define the Bitwise-Exclusive-OR O...

Define the Bitwise-Exclusive-OR Operator: ^: The bitwise-exclusive-OR operator (^) compares every bit of its first operand to the corresponding bit of its second operand. If on

Program to calculation of mortgage interest rates, This assignment builds o...

This assignment builds on Homework 3. The two major modifications are the instruction of pointers and the calculation of mortgage interest rates. Requirements for Project 2:

Gross pay, Develop a C++ program that uses a while to determine the gross p...

Develop a C++ program that uses a while to determine the gross pay (in Dollars) for each of several employees. The company pays “straight-time” for the first 40 hours worked by eac

Tree, Write algorithm and program for the conversion of a Tree to a Binary ...

Write algorithm and program for the conversion of a Tree to a Binary Tree

Sort wars, Explain each of the algorithms in a way that would be understand...

Explain each of the algorithms in a way that would be understandable to an intelligent person who is not familiar with programming. You should not use any code (or even pseudo code

Enumeration types, Write a simple program in C++ to investigate the safety ...

Write a simple program in C++ to investigate the safety of its enumeration types. Include at least 10 different operations on enumeration types that are incorrect/unsafe things to

Code for design software, In this project, you will write a software for th...

In this project, you will write a software for the Registrar's office of a university called YouOIT to maintain information about students and courses at the university. The reg

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd