Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem B: Flip Array You are given several 2D arrays (matrices) of integers at the input. You must write a program to flip each array

image text in transcribedimage text in transcribed

Problem B: Flip Array You are given several 2D arrays (matrices) of integers at the input. You must write a program to flip" each array around the main diagonal; ie., to print out the transposed matrix. For example, if a 2 x 3 array is given as follows: 4-5 O you must produce the following transposed matrix 3 x 2 2 -5 3 0 Several matrices can be given in the standard input. Input The input consists of a sequence of matrices. Each matrix starts with two positive integers n and m, which specify the number of rows and columns of the matrix, followed by all numbers in the matrix, organized by rows and columns. The end of input is marked by two zeros Output For each input matrix, you must print the same matrix, but transposed. First, you must print the dimensions of the transposed matrix, which are obviously swapped dimensions of the input matrix. After that, you need to print all rows of the transposed matrix. Print one space before printing each number, so that the numbers in each row are separated. This means that there will be one space at the very beginning of each row. After printing a matrix, print one empty line in order to separate the matrix from the next one. Again, this means that there will be an empty line after the last matrix as well. Check the sample input and output and make sure that program produced output in the exact expected format

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions