Question: Write a program to determine the coordinates of a number in a matrix of arbitrary dimensions, as specified through console input. First, you must request

Write a program to determine the coordinates of a number in a matrix of arbitrary dimensions, as specified through console input.

First, you must request and receive the matrix row count from the user.

What is the matrix row count?

Then request and receive the matrix column count.

What is the matrix column count?

At this point, consider a matrix of the specified dimensions, numbered sequentially in row-major order. For example, if the user entered 3 for the row count, and 2 for column count, the matrix would look like this:

[01] 23 L4 5. public class Matrix { } public static void

Then request and receive a number from the user.

What is your number? 3

Finally, tell the user which row and column their number is in.

An example of the full console output is:

what is the matrix row count?

3

what is the matrix column count?

2

What is your number?

2

2 is in row 1 and column 0

See the above matrix for why the number 2 is located in row 1 and column 0.

Note that you don't actually need to create a matrix to solve this exercise. Sample code

Main() { Console.WriteLine("what is the matrix row count?"); }

[01] 23 L4 5. public class Matrix { } public static void Main() { Console.WriteLine("what is the matrix row count?"); }

Step by Step Solution

3.47 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

C Code using System class Matrix static void Main introwscolumnsnumber ConsoleWriteLineWhat is the matrix row count rowsintParseConsoleReadLine Consol... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!

Related Book