1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IRINA_888 [86]
3 years ago
11

6. Write a program that can multiply an n x m matrix and m x n matrix together: The input specifications are these: Read n and m

using scanf function. Read two matrices using a for loop inside the main function. The output (product) matrix must be computed in a function named matrix_mult which will have the two input matrices as arguments.
Computers and Technology
1 answer:
Whitepunk [10]3 years ago
7 0

Answer:

see explaination

Explanation:

#include <stdio.h>

#include <malloc.h>

void matrix_mult(int **m1, int **m2, int **m3, int n, int m) {

int i, j, k, sum=0;

for(i = 0; i < n; ++i) {

for(j = 0; j < n; ++j) {

sum = 0;

for(k = 0; k < m; ++k) {

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

}

m3[i][j] = sum;

}

}

}

int main() {

int n, m, i, j;

int **m1, **m2, **m3;

printf("Enter number of rows: ");

scanf("%d", &n);

printf("Enter number of columns: ");

scanf("%d", &m);

m1 = malloc(sizeof(int *) * n);

m2 = malloc(sizeof(int *) * m);

m3 = malloc(sizeof(int *) * n);

for(i = 0; i < m; ++i) {

m1[i] = malloc(sizeof(int) * m);

m2[i] = malloc(sizeof(int) * n);

m3[i] = malloc(sizeof(int) * n);

}

printf("Enter first matrix\n");

for(i = 0; i < n; ++i) {

for(j = 0; j < m; ++j) {

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

}

}

printf("Enter second matrix\n");

for(i = 0; i < m; ++i) {

for(j = 0; j < n; ++j) {

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

}

}

matrix_mult(m1, m2, m3, n, m);

printf("product is\n");

for(i = 0; i < n; ++i) {

for(j = 0; j < n; ++j) {

printf("%d ", m3[i][j]);

}

printf("\n");

}

printf("Enter first matrix: ");

return 0;

}

You might be interested in
What are the types of action involving data base?
Alexeev081 [22]

Answer: The DBMS is a software system that explains the four types of actions, which are defining, constructing, manipulating, and sharing databases among various users and applications.

3 0
3 years ago
Select the correct answer.
Ierofanga [76]

The program which would help Eva convert a Lisp file into machine code by interpreting only a single line of code at a time is: A.  interpreters

Interpreters can be defined as computer software programs that are designed to translate (interpret) a programming language (code) into machine code, especially by interpreting only a single line of code at a time.

Hence, an interpreter executes the instructions that are written in a programming language (code) one after the other (instruction by instruction), before it translate (interpret) the next line of code.

On the other hand, a compiler takes the entire program (code) and interprets them.

In conclusion, an interpreter can help Eva convert a Lisp file into machine code by interpreting only a single line of code at a time.

Rea d more: brainly.com/question/21130620

5 0
2 years ago
The most common markup language used with web pages is ___________ Question 4 options: A. HTML B. VRML C. Javascript
leonid [27]
Hi there!

The correct answer is A. HTML.

HTML stands for Hypertext Markup Language which is used in nearly all websites and web-based programs. HTML acts as a structure for a website giving you the text, page titles, text-boxes, etc... HTML is also used along with the languages of Javascript, CSS, C++, and others. DO NOT confuse languages like Javascript and the rest with Markup Languages because they are not the same! Javascript, for example, is what is used to make websites more user-friendly and interactive. When you use Brainly, for example, and you hover over someone's name or picture and that box pops up that is Javascript at work and not HTML or any other Markup Language.

-<span>ASIAX </span><span>  </span><span>Frequent Answerer</span>
4 0
3 years ago
Read 2 more answers
Small programs called _______ are used to communicate with Paris Friel devices such as monitors printers portable storage device
algol13

the answer is D drivers

7 0
3 years ago
Choose the correct line of code.
Naddika [18.5K]
Def_pow_(self,b): if not then I’m sorry
5 0
2 years ago
Other questions:
  • Susan bought a new sweater on sale for $28.93.she was charged HST of 13%.find the total amount of her bill including taxes.​
    9·1 answer
  • If you delete a file from removable media, it is stored in the recycle bin where you can recover it until you empty the recycle
    13·1 answer
  • 0001 0000 1100 0011 (unsigned, that is, interpreted as b2u)i.8 bit truncated value:ii.does the value change when truncated to 8
    7·1 answer
  • If Word finds a potential error in a document, a red, green, or blue wavy underline flags the problem.
    14·1 answer
  • Write a program that:
    13·1 answer
  • Write a program that will add up the series of numbers: 99, 98, 97… 3, 2, 1. The program should print the running total as well
    13·1 answer
  • What common variation of the Server Message Block (SMB) sharing protocol is considered to be a dialect of SMB?
    11·1 answer
  • Laura is filming a scene in which the subject is sitting with a lit fireplace behind him. The only other source of light in the
    15·1 answer
  • If you anticipate running a particular query often, you can improve overall performance by saving the query in a special file ca
    11·1 answer
  • The _________________ creates international guiding principles for computer forensic examiners.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!