006-002-005
Nested For: Number Table
Easy
Problem Description
Nested For: Number Table
Learning Objective: Create 2D pattern with nested for loops
Create program that inputs rows and columns and creates number table displaying coordinates. Display "row-column" in each cell.
Input
Line 1: Row count (integer)
Line 2: Column count (integer)
Output
1-1 1-2 1-3 ...
2-1 2-2 2-3 ...
...
```java
(display row-column in each cell, space-separated)
## Examples
### Example 1: 2 rows 3 columns
Input:
```java
2
3
```java
Output:
```java
1-1 1-2 1-3
2-1 2-2 2-3
```java
### Example 2: 3 rows 2 columns
Input:
```java
3
2
```java
Output:
```java
1-1 1-2
2-1 2-2
3-1 3-2
```java
### Example 3: 1 row 1 column (minimum)
Input:
```java
1
1
```java
Output:
```java
1-1
Test Cases
※ Output examples follow programming industry standards
Input:
2 3
Expected Output:
1-1 1-2 1-3 2-1 2-2 2-3
Input:
3 2
Expected Output:
1-1 1-2 2-1 2-2 3-1 3-2
Input:
1 1
Expected Output:
1-1
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
