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 is white noise and how does it affect a signal? Provide a business process example that could be affected and what would yo
marin [14]

Answer: White noise is the merging of the audible signal of different frequencies varying from high to low into a single unit. The number of frequencies combined  in white noise more than 20,000. It helps in masking the other noise in the environment.

In accordance with the signal, white noise acts as a statistical mode which merges all the signal into one with same intensity which results in the power spectral density being persistent.

E.g.- Any business process of company that requires attention and speedy working such as creating report, presentation can get affected by the white noise in positive  or negative manner depending on the person.It might lead to increment or decrement in the cognitive performance of employees.

White noise can be remove by several software present in the market, removing it by the "Noise removal" option from the Effects menu in operating system, etc.  

5 0
3 years ago
What is the software that finds websites, webpages, images, and other information called?search applicationsubject directorysubj
san4es73 [151]
It is called a search application
7 0
4 years ago
Read 2 more answers
Open punctuation means that no punctuation follows the salutation or complimentary close. *
zloy xaker [14]

Answer:

True

Explanation:

When open punctuation is used, we do not expect the use of punctuation after salutation or complimentary close. It is a relatively new concept in business writing and we can rightly use this method in modified block letter style of writing.  

Some companies have developed business letter templates that are arranged in an open style, which permits the use of open punctuation in all aspect of business writings.  

7 0
3 years ago
Click this link to view O*NET’s Work Styles section for Petroleum Engineers. Note that common work styles are listed toward the
inysia [295]

Answer:

2 (cooperation )

3 (integrity)

5 (analytical thinking)

6 (dependability)

Explanation:

Good luck! Hope this helps.

4 0
3 years ago
Read 2 more answers
Which of the following is the fastest growing input technique​
Natali [406]
We need more information for this one, please.
8 0
3 years ago
Other questions:
  • Does technology get in the way of learning ?<br> Help Meh ! ♥ Some ideas :D
    14·2 answers
  • "This command will give you a listing of your basic IP information for the computer you are using"
    6·1 answer
  • which of the following scenarios is a circumstance in which it would be ethical to practice confidentiality?
    8·1 answer
  • 1. Reference initials are always typed on a business letter.
    6·1 answer
  • c++ Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value is c
    14·2 answers
  • Mencione algunos ejemplos en donde sean utilizadas las máquinas de aire comprimido. Justifique su respuesta.
    7·1 answer
  • What is a current trend in ERP systems?
    12·1 answer
  • Sound technology has been influenced the most by the ___.
    5·2 answers
  • Well I ended up figuring it out
    7·1 answer
  • Testing components for satellites is a classic example of
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!