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

Pro, i need to do my home work

i need to do my home work

Problem : Compiler Design - Limit the methods, Rahul is a newbie to the pro...

Rahul is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''{'' and end with '

Why shouldn''t matrix class''s interface look like an array, Why shouldn't ...

Why shouldn't Matrix class's interface look like an array-of-array? A: Some people build a Matrix class that has an operator[] that returns a reference to an Array object (or po

Is it legal for a member function to say delete this?, Is it legal for a me...

Is it legal for a member function to say delete this? A: As long as you're cautious, it's OK for an object to delete this. Here's how I define "cautious": You have to be a

.C# mouse and maze program, .Create a Csharp solution that will show a maze...

.Create a Csharp solution that will show a maze in the user interface and will show a mouse walking through the maze attempting to locate the exit door (the cheese).

Constructors and destructors, Constructors and Destructors: A Class is ...

Constructors and Destructors: A Class is defined as constructor by declaring a constructor in the form of function inside the class.  In other word a function in the name of

Program to create a digital clock, Create a C language code, only one progr...

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu

Program is to perform string operations, Program is to perform string opera...

Program is to perform string operations: Program is to perform string operation without using in built functions using classes and object void mainmenu()    {    clrs

C program to maintain database of employees, Aim: To implement a program t...

Aim: To implement a program to maintain information of employees in an educational institute using inheritance. Code:                       class staff {

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