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
natta225 [31]
3 years ago
13

Write a program (using functions) starting from directives to compute and display the transpose of a matrix of dimension m x n.

[Note: Here, transpose of a matrix means the element at row r and column c in the original is placed at row c and column r of the transpose]. (Programming in C)
Computers and Technology
1 answer:
pentagon [3]3 years ago
3 0

Answer:

#include <iostream>

#include <cstdlib>

using namespace std;

int m, n;

void transpose(int matrix[]){

  int transp[m][n];

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

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

        transp[j][i] = matrix[i][j];

        cout<< transp[j][i]<< " ";

     }

     cout<< "\n";

  }

}

int main(){

  cout<< "Enter the value for n: ";

  cin>> n;

  cout>> "Enter the value for m: ";

  cin>> m;

  int mymatrix[n][m];

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

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

        mymatrix[i][j] = (rand() % 50);

     }

  }

  transpose(mymatrix);

}

Explanation:

The C source code defined a void transpose function that accepts a matrix or a two-dimensional array and prints the transpose on the screen. The program gets user input for the row (n) and column (m) length of the arrays. The C standard library function rand() is used to assign random numbers to the array items.

You might be interested in
Which osi model layer manages data encryption?
Hoochie [10]
The presentation Layer manages data encryption.
7 0
4 years ago
You can include up to _____ logical conditions in the and function. (487181)
Allushta [10]
Hi ! 

<span>You can include up to <u>255</u> logical conditions in the and function. </span>
8 0
3 years ago
True or False <br><br> Rootkits are only made by black-hat hackers.
Kipish [7]
True rookies are only made by black hat hackers I am not sure I hope this will help
4 0
3 years ago
Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.
zysi [14]
Procedure SumEvenOdd(stdin: array [0..100] of integer)
var
   i, sum_even, sum_odd: integer;

begin
   for i := 0 to 100 do begin
       if stdin[i] < 0 then
           break;
       if stdin[i] mod 2 = 0 then //even number
          sum_even := sum_even +  stdin[i]
       else 
          sum_odd := sum_odd +  stdin[i]; 

       ShowMessage('sum of even is ' + IntToStr(sum_even) + ' ' + 'sum of odd                                  is' + IntToStr(sum_odd) ) ;
   end; 

end
5 0
4 years ago
Select the correct answer.
dedylja [7]

Answer:

D. MAN

Explanation:

A local area network (LAN) refers to a group of personal computers (PCs) or terminals that are located within the same general area and connected by a common network cable (communication circuit), so that they can exchange information from one node of the network to another. A local area network (LAN) is typically used in small or limited areas such as a set of rooms, a single building, school, hospital, or a set of well-connected buildings. Some of the network devices or equipments used in a local area network (LAN) includes an access point, personal computers, a switch, a router, printer, etc.

On the other hand, a metropolitan area network (MAN) is formed by an aggregation of multiple local area network (LAN) that are interconnected using backbone provided by an internet service provider (ISP). A metropolitan area network (MAN) spans for about 5 kilometers to 50 kilometers in size.

Basically, a metropolitan area network (MAN) spans across a geographic area such as a city and it's larger than a local area network (LAN) but significantly smaller than a wide area network (WAN).

In conclusion, the network type that the patrol services of a city's police department would most likely use is a metropolitan area network (MAN).

6 0
3 years ago
Other questions:
  • You have just deployed SNMPv3 in your environment. Your manager asks you to make sure that your SNMP agents can only talk to the
    13·2 answers
  • Which of the following should businesses and organizations do to promote a safe work environment?
    6·1 answer
  • What operating system type uses icons to represent programs
    9·2 answers
  • Why should a person consider doing an apprenticeship?
    7·1 answer
  • A cable that connects the computer to the printer is an example of<br> A.hardware<br> B.software
    13·2 answers
  • Why is it important to put the most specific case first? What types of errors does it help avoid?
    11·1 answer
  • Mr. O would like to purchase a new computer for his home business. Mr. O's current computer runs very slow when he is running e-
    5·2 answers
  • 6) Read the article posted on The Verge entitled How to fight lies, tricks, and chaos online and summarize the four steps. Then
    15·1 answer
  • Mention five of the format tools use to edit a picture in a word document<br>​
    13·1 answer
  • What is the correct sequence in which a computer operates​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!