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
MAVERICK [17]
3 years ago
15

Write a program to read in a two values row and col to initialize a 2D array using those values. Then create a function FindTran

spose to print both the original matrix and the transpose of the matrix.
Computers and Technology
1 answer:
anyanavicka [17]3 years ago
4 0

Answer:

The program to this question can be defined as follows:

Program:

#include <stdio.h> //defining header file

void FindTranspose(int r,int c,int ar[][c]);

int main() //defining main method

{

int r,c,i1,j1; //defining integer variable

printf("Enter row values: "); //message

scanf("%d",&r);//input row values

printf("Enter column values: "); //message  

scanf("%d",&c);//input column values

printf("input matrix number: "); //message

//defining loop to input value from user end

int ar[r][c]; //defining array

//input value in the loop

for(i1=0;i1<r;i1++)// row value

{

for(j1=0;j1<c;j1++)// column value

{

scanf("%d",&ar[i1][j1]); //input values

}

}

FindTranspose(r,c,ar); //calling function.

return 0;

}

//function FindTranspose to print original and transpose 2D array.

void FindTranspose(int r,int c,int ar[][c])

{

int i1,j1; //defining integer variable

printf("\nMatrix: \n"); //message

//print matrix

for(i1=0;i1<r;i1++)// row value

{

for(j1=0;j1<c;j1++)// column value

{

printf("%d ",ar[i1][j1]); // print value

}

printf("\n");

}

//print transpose matrix.

printf("\nTranspose of matrix\n"); //message

for(i1=0;i1<c;i1++)// column value

{

for(j1=0;j1<r;j1++)// row value

{

printf("%d ",ar[j1][i1]); //print value

}

printf("\n");

}

}

Output:

Enter row values: 2

Enter column values: 3

input matrix number: 1

2

43

5

6

7

Matrix:  

1 2 43  

5 6 7  

Transpose of matrix

1 5  

2 6  

43 7  

Explanation:

In the given code, the first header file is included, then declares a method, that is "FindTranspose". In this method, parameter two integer parameter and an array variable is passed.

  • Then the main method is declared, inside the main method, four integer variable "i1,j1,r,c, and ar" is declared, in which variable i1 and j1 used in loop and r,c is used to take input value of row and columns, and in the "ar" array we input value from the user, after input array element we call "FindTranspose" and pass a parameter, that is "ar,r, and c".
  • Inside the "FindTranspose" method, two integer variable "i1, and j1" is used in the loop, in the first loop it will print normal matrix, and in the second loop, it will print the inverse of this matrix.
You might be interested in
What is the major benefit Smartphones and tablet computers have had on social media?
Naddika [18.5K]

Answer:

c

Explanation:

The biggest advantage of smartphones and tablets is that they increased the mobility. This allowed users to access the social media platforms whenever they want. The users can login to their accounts even they are travelling by bus or walking around. This was not possible back in the days where people mostly use desktop computers.

8 0
2 years ago
Which element can be changed using the Print pane? Check all that apply.
Ronch [10]

Answer:

B

C

D

E

Explanation:

5 0
3 years ago
Read 2 more answers
It would be system unit on this test
Dima020 [189]
Yes thats correct- but if 
3 0
3 years ago
Which is the last step in conducting a URL search?
dimulka [17.4K]
The user's browser renders the html code as a visual web page
3 0
3 years ago
Which troubleshooting tool enables you to connect to a user's remote computer, view and interact with the user's screen, and cha
DaniilM [7]
That would be Remote assistance.
6 0
3 years ago
Other questions:
  • Your network employs basic authentication that centers on usernames and passwords. However, you have two ongoing problems. The f
    13·1 answer
  • Many malware attacks are ____ attacks, which involve more than one type of malware and/or more than one type of transmission met
    6·1 answer
  • A(n) _________ is a computer system which is part of a larger system which performs a dedicated function.
    8·1 answer
  • A user notices that a mobile device is draining power faster than is normal. What are three causes of quick battery drain? (Choo
    5·1 answer
  • Select all statements below that are TRUE for For...Next loops. A. It is used for a fixed number of iterations. B. It is used fo
    10·1 answer
  • Which of the following best describes the basic purpose of the internet?
    11·1 answer
  • Biểu diễn cây sau bằng mảng một chiều
    12·1 answer
  • GMI = $4,666.67 Total Monthly Deductions $1,131.00 What is the Net Monthly Income (GMI - Total Monthly Deductions) =
    9·1 answer
  • What types of things were often NOT captured in early photographs?
    7·1 answer
  • When was the first analog device, the phonautograph, launched?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!