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
programing code on board coloring in clanguage


Define Some Features of Automatic Variables in C program? The features of automatic variables are like as Storage - memory Default initial value - an unpredictable value,


Create an applet that bounces a blue ball inside an applet using Thread. The ball (diameter is 10) will start at position (0,0). When the ball hits the edge of the applet, the ba

Important Note: No course works, which have been submitted via hard copies or emails, will be accepted a short essay below edited in a document (word, other) files with

What are the benefits of using friend classes? - Friend classes are useful when a class wants to hide features from users which are required only by another, tightly coupled cl

Program to show the ascii value of characters: int main() {                 int one_char;                 cout                 one_char = getch();


Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec