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

 

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

Posted Date: 9/29/2012 2:40:04 AM | Location : United States







Related Discussions:- multiplication of matrices with compatibility check, Assignment Help, Ask Question on multiplication of matrices with compatibility check, Get Answer, Expert's Help, multiplication of matrices with compatibility check Discussions

Write discussion on multiplication of matrices with compatibility check
Your posts are moderated
Related Questions
A: They are following: Const: point out that memory once initialized, must not be modify through a program. Volatile: denote that value in the memory location can be modified

Write a main program that uses these system calls to echo the typed characters. The pseudo code will look something like: void traphandler ()  {    if (R0 == 0) { // read sys

Project Description: We are looking to have software that we will use to track employee information regarding our wellness program. We would like the system to be able to follow

Example for external storage class - computer programming? extern double sin (double); In a function prototype, for the sin() function its function definition ~ we can write

how can i make a program with !(not) operator

What I need is an auto-click bot. The auto-click bot would ask me for a url(or it would be pre-defined too) so that it loads that specific url and click an ad automatically. This w

All languages are divided into six sections: - variables, I/O maths, conditional expressions, arrays, functions, subroutines and file handlers. Learning a software language is simi

Develop a Student class that has the following header file: #ifndef STUDENT_H #define STUDENT_H #include #include #include using namespace std; class Stu

2 flowcharts, pseudocode for each (at least 4 algorithms), and code for either a stack or a queuestion..

#padovan string in java   program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class PadovanStrin