Write a C program multiplication of two matrices?

1 Answer

Answer :

// Write a C program Multiplication of Two Matrices.
#include<stdio.h>
#include<conio.h>
void main()
{
 int a[25][25],b[25][25],c[25][25],i,j,m,n,k,r,s;
 clrscr();
 printf("enter the rows and colums of A matrics:\n");
 scanf("%d%d",&m,&n);
 printf("enter the rows and colums of B matrics:\n");
 scanf("%d%d",&r,&s);
 printf("\nenter the elements of A matrics");
 for(i=0;i<m;i++)
 {
 for(j=0;j<n;j++)
 scanf("\t%d",&a[i][j]);
 }
 printf("\nenter the elements of B matrics");
 for(i=0;i<m;i++)
 {
 for(j=0;j<n;j++)
 scanf("\t%d",&b[i][j]);
 }
 printf("\nThe elements of A matrics");
 for(i=0;i<m;i++)
 {
 printf("\n");
 for(j=0;j<n;j++)
 printf("\t%d",a[i][j]);
 }
 printf("\nThe elements of B matrics");
 for(i=0;i<m;i++)
 {
 printf("\n");
 for(j=0;j<n;j++)
 printf("\t%d",b[i][j]);
 }
 for(i=0;i<m;i++)
 {
 printf("\n");
 for(j=0;j<n;j++)
 {
 c[i][j]=0;
 for(k=0;k<m;k++)
 c[i][j]=c[i][j]+a[i][k]*b[k][j];
 }
 }

 printf("\nThe Multiplication of two matrics");
 for(i=0;i<m;i++)
 {
 printf("\n");
 for(j=0;j<n;j++)
 printf("\t%d",c[i][j]);
 }
 getch();
}

Related questions

Description : Write a C program addition of two matrices?

Last Answer : #include #include void main() { int a[25][25],b[25][25],c[25][25],i,j,m,n; clrscr(); printf("enter the rows and colums of two matrics:\n"); scanf("%d%d",&m,&n); printf("\nenter the elements of A matrics"); for(i=0;i

Description : what is function? Write types of function with example?

Last Answer : Function: Function means, a large program can be divided into a series of individual related programs called modules. These modules are called functions. A function is a program segment that carries out ... efficiency of program. 4 : Function sharing : A function can be shared by many programmers.

Description : What is an Array? Write advantages of arrays?

Last Answer : An array is a collection of similar data items. All the data items of an array are stored in continuous memory locations in RAM. The elements of an array are of same data type and each item can be accessed using the same name.

Description : Write categeory of functions ?

Last Answer : CATEGORY OF FUNCTIONS : A function, depending on whether arguments are present or not and whether a value is returned or not. The following are the function prototypes. 1 : Functions with no ... : Functions with Parameters and no Return Values. 4 : Functions with Parameters and Return Values.

Description : What is function definition? (OR) what is user defined function? (OR) Write syntax of user defined function?

Last Answer : Function Definition : The program module that is written to achieve a specific task is called function definition. Syntax : type function-name(parameter list) // function header. { declaration of variables; body of function; // ... and b ); scanf( %d%d ,&a,&b); c=a+b; printf( %d ,c); }

Description : Write types of functions?

Last Answer : The functions can be classified into two categories. 1 : Built in Functions (OR) Library Functions 2 : User-defined Functions. 1 : Built-in Functions (OR) Library Functions : The standard C ... increase efficiency of program. 4 : Function sharing : A function can be shared by many programmers.

Description : What is a function? Write advantages of function?

Last Answer : Function: Function means, a large program can be divided into a series of individual related programs called modules. These modules are called functions. A function is a program segment that carries ... efficiency of program. 4 : Function sharing : A function can be shared by many programmers

Description : What is call by value and call by reference?

Last Answer : PASSING PARAMETERS TO FUNCTIONS : The called function receives the information from the calling function through the parameters. The variables used while invoking the calling function are called actual parameters and the variables used in the ... *b) { int temp; temp=*a; *a=*b; *b=temp; }

Description : Explain category of functions with examples?

Last Answer : CATEGORY OF FUNCTIONS : A function, depending on whether arguments are present or not and whether a value is returned or not. The following are the function prototypes. 1 : Functions with no Parameters and no Return Values. 2 : ... (); } int sum(int a,int b) { int c; c=a+b; return c; }

Description : How to initialization of array with example?

Last Answer : Initilization of Array : assigning the required information to a variable before processing is called initialization.we can initialize the individual elements of an array. Array elements can be initialized at the time of declaration. Syntax : ... M','P','U','T','E','R'}; char b[] = COMPUTER ;

Description : What is the macro function?

Last Answer : Macro Substitution : They are two types of macro substitution. 1 : Macro substitution without arguments. 2 : Macro substitution with arguments. 1 : Macro substitution without arguments : It is a process to ... varn like the formal parameters in a function definition. Ex : #define PROD(x) (x*x)

Description : What is call by reference? (OR) what is pass by reference?

Last Answer : Pass by reference (OR) Call by Reference : In pass by reference, a function is called with addresses of actual parameters. In the function header, the formal parameters receive the addresses of actual parameters. Now the formal parameters do ... a,int *b) { int temp; temp=*a; *a=*b; *b=temp; }

Description : What is call by value? (OR) what is pass by value?

Last Answer : Pass by value (OR) Call by value : When a function is called with actual parameters, the values of actual parameters are copied into formal parameters. If the values of the formal parametes changes in the function, the values of ... void swap(int a,int b) { int temp; temp=a; a=b; b=temp; }

Description : What is return statement in function?

Last Answer : Return Statement : The return statement may or may not send back any values to the calling function(main program). Syntax : return; // does not return any value or return(exp); // the ... function can return some values other than int type, then we must specify the data type to be return.

Description : What are the function variables? (OR) What are the local and global variables?

Last Answer : FUNCTION VARIABLES : They are two types of variables. 1 : Local Variable. 2 : Global Variable. 1 : Local Variable : The local variables are defined within the body of the function or block. These ... variables m' and n' are defined outside the main() function. Hence they are global variables.

Description : What are the function parameters?

Last Answer : PARAMETERS : parameters provides the data communication between the calling function and called function. They are two types of parametes 1 : Actual parameters. 2 : Formal parameters. 1 : Actual Parameters : These ... . . } Where a, b are the Actual Parameters x, y are the Formal Parameters

Description : What is calling function? (OR) what is function call?

Last Answer : Function Call : The function can be called by simply using the function name. Syntax : function-name(); function-name(parameters); return value = function-name(parameters); Ex : add(); // function ... ,b); // function with arguments. c=fun(a,b); // function with arguments and return values

Description : How to Decleration of function?

Last Answer : Function Declaration (Function Prototype) : Like variable, all functions in a C program must be declared, before they are invoked. The declaration of each function should end with semicolon. Ths is ... : Parameter list declares the variables that will receive the data sent by the calling program.

Description : Statement 1: The product of two diagonal matrices of order 3 is also a diagonal matrix. Statement -2 : In general, matrix multiplication is non-commut

Last Answer : Statement 1: The product of two diagonal matrices of order 3 is also a diagonal matrix. Statement -2 ... Statement -1 is false, statement -2 is true.

Description : The minimum number of scalar multiplication required, for parenthesization of a matrix-chain product whose sequence of dimensions for four matrices is is (1) 630 (2) 580 (3) 480 (4) 405 

Last Answer : (4) 405 

Description : Write a program for addition of two 3 x 3 matrices.

Last Answer : #include<stdio.h> #include<conio.h> void main() { int a[3][3],b[3][3],c[3][3],i,j; clrscr(); printf("Enter first matrix elements:\n"); for(i=0;i<3;i++) { for(j=0;j<3 ... (j=0;j<3;j++) { printf("%d\t",c[i][j]); } } getch(); }

Description : Write a program to accept two numbers from user and perform addition, subtraction, multiplication and division operations using pointer.

Last Answer : #include #include void main() { int no1,no2,*ptr1,*ptr2,result; clrscr(); printf("Enter no1:"); scanf("%d",&no1); printf("\nEnter no2:"); scanf("%d",&no2); ptr1=&no1; ptr2=&no2; ... "\n Multiplication=%d",result); result=*ptr1/(*ptr2); printf("\n Division=%d",result); getch(); }

Description : How Write javascript program to display multiplication table of 2 without accepting input from user?

Last Answer : Use a counted for loop. On each iteration, multiply the controlvariable by 2 and print the result.

Description : Write a C++ program to print multiplication table of 7. (example: 7 x 1 ….7 x 10 = 70) 

Last Answer : #include #include void main() { int num; clrscr(); cout

Description : Develop a simple ‘C’ program for addition and multiplication of two integer numbers.

Last Answer : #include<stdio.h> #include<conio.h> void main() { int a,b,add,mul; clrscr(); printf("Enter value for a and b:"); scanf("%d%d",&a,&b); add=a+b; ... b=%d\n",add); printf("\Multiplication of a and b=%d",mul); getch(); }

Description : Is there a way to factor a matrix into two matrices with this special property? (see details)

Last Answer : My gut feeling is that this cannot be done. If it could, it would be such an extraordinary result that I am sure that I would have heard of it. I would think that in general integer matrices can not be factored as the product of integer matrices.

Description : Python : how to check if two arrays (matrices) have the same shape and elements -Web-Development

Last Answer : answer:

Description : Python : comparing two arrays (matrices) element-wise -Web-Development

Last Answer : answer:

Description : The product of two matrices, i.e., AB = I, then B is called the___ of A and written as____.

Last Answer : The product of two matrices, i.e., AB = I, then B is called the___ of A and written as____.

Description : The mass, stiffness, and damping matrices of a two-degree-of-freedom system are symmetric.

Last Answer : True

Description : Matrices to solve a vector combination problem.

Last Answer : I am completely confused by your notation…

Description : Which of the following is NOT correct (A, B and C are matrices) a.A∙B = B∙A b.A∙B∙C = (A∙B) ∙C = A∙ (B∙C) c.C(A+B) = C∙A + C∙B d.1 A = A 1

Last Answer : a.A∙B = B∙A

Description : From the following, which one will require 4 matrices to multiply to get the final position? a.Rotation about the origin b.Rotation about an arbitrary Point c.Rotation about an arbitrary line d.Scaling about the origin

Last Answer : b.Rotation about an arbitrary Point

Description : Python : how can I concatenate scipy.sparse matrices? -Web-Development

Last Answer : answer:

Description : If the order of matrices A, B and C are `3 xx 4, 7 xx 3 " and " 4 xx 7` respectively, then the order of (AC) B is _____.

Last Answer : If the order of matrices A, B and C are `3 xx 4, 7 xx 3 " and " 4 xx 7` respectively, then the order of (AC) B is _____.

Description : How do you multiply matrices?

Last Answer : The browser used by this site is not really designed for this answer but here's an attempt.Suppose A and B are matrices with dimensions pxq and qxr where p, q and r are positive integers.Then the (i, j)th term in ... all k, of ai,k*bk,j. where ai,k is the element in the ith row and kth column of A.

Description : Matrices like BCG Growth Share & GE Mckinsey Business Portfolio are use to evaluate___________________? A. Business Level Strategy B. Product Level Strategy C. Corporate Level Strategy D. Functional Level Strategy

Last Answer : Corporate Level Strategy

Description : For stable structures, one of the important properties of flexibility and stiffness matrices is that the elements on the main diagonal (i) Of a stiffness matrix must be positive (ii) Of a stiffness matrix must be negative (iii) Of ... ) (B) (ii) and (iii) (C) (i) and (iv) (D) (ii) and (iv)

Last Answer : (A) (i) and (iii)

Description : Why is it difficult to use matrices on deciduous teeth, A. It hurts the kids’ parents B. The small mouth opening of kids in that age range makes it difficult to keep matrices in mouth. C. The occlusal concavity of deciduous teeth

Last Answer : . The occlusal concavity of deciduous teeth

Description : the difficulty of placing matrices on deciduous dentition is a result of, A. The small mouth of kids which result in problem keeping the matrices in their mouths B. The occlusal convergence of the deciduous teeth

Last Answer : B. The occlusal convergence of the deciduous teeth

Description : Write a multiplication equation with one variable and one fraction that has the solution of 8?

Last Answer : 1/2x=4

Description : Find a letter from the Bengali alphabet , which is divided into two numbers by addition , subtraction , multiplication , 12 , 8 , 26 and 3, respectively, what is the letter ?

Last Answer : The letter ' ঔ ' ... If you divide it side by side, 9 above and 3 below. Which is 9 + 3 = 12 , 9-3 = 8 , 9 * 3 = 26 , 9/3 = 3.

Description : Which is an algorithm or techniques used to multiply two numbers. a. Addition algorithm b. Subtraction algorithm c. Multiplication algorithm d. __ Allof these

Last Answer : c. Multiplication algorithm

Description : Which algorithm includes repeated addition of two predetermined values A and S to a product P and then performs a rightward arithmetic shift on P. a. Booth’s algorithm b. Usual algorithm c. Multiplication algorithm d. None of these

Last Answer : a. Booth’s algorithm

Description : Which algorithm is used to find GCD of two integers. a. Multiplication algorithm b. Division algorithm c. Addition algorithm d. Simple algorithm

Last Answer : b. Division algorithm

Description : Shifting a register content to left by one bit position is equivalent to (A) division by two. (B) addition by two. (C) multiplication by two. (D) subtraction by two

Last Answer : (C) multiplication by two.

Description : Does learning the multiplication table seem less daunting when you realize there are only fifteen entries to memorize?

Last Answer : I don't use the same tricks as you, but I agree each number has its own set of tricks. Times 2 is basically like addition, just doubling. 9's you only have to visualize half the numbers, because the other ... 's one week, then 3's the next week, etc. That's how I remember it from my own childhood.

Description : What grade did you start learning multiplication?

Last Answer : In Tennessee, we started learning to multiply simple numbers in third grade. Yes, allusions to the reproduction of rabbits was sometimes used. I didn’t have to memorize multiplication tables until fifth grade. By then, we had to memorize them and answer questions in drills or quizzes.

Description : Can a CPU use multiplication instead of adding?

Last Answer : Multiplication is addition.

Description : Did you ever realize that long division is the reverse operation of multiplication?

Last Answer : Kinda always known this. However, by all means teach this. I took a grotesque amount of math in High School and College and I have tutored all three of my sisters kids in math for the last decade. In high ... taught how.. In college I learned the why . The latter is a hell of a lot more valuable.