Question
C# programming Requirements: In this exercise you are to determine the coordinates of a number in a matrix of arbitrary dimensions, as specified through console
C# programming
Requirements:
In this exercise you are 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 size from the user.
What is the matrix row size?
Then request and receive the matrix column size.
What is the matrix column size?
At this point, consider a matrix of the specified dimensions, numbered sequentially in column, row order. For example, if the user entered 3 for the row size, and 3 for column size, the matrix would look like this:
0 | 1 | 2 |
3 | 4 | 5 |
6 | 7 | 8 |
Then request and receive a number from the user.
What is your number?
Finally, tell the user which row and column their number is in.
An example of the full console output is:
0 | 1 | 2 |
3 | 4 | 5 |
6 | 7 | 8 |
What is the matrix row size?
3
What is the matrix column size?
3
What is your number?
3
3 is in row 1 and column 0
See the above matrix for why the number 3 is located in row 1 and column 0.
Note that you don't actually need to create a matrix to solve this exercise.
Use the following skeleton as a basis for your program:
public class Matrix
{
public static void Main()
{
Console.WriteLine("What is the matrix row size?");
}
}
Don't forget to add a Console.ReadLine() at the end of the program so it doesn't close automatically when debugging.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started