006-002-003
Nested Loops: Multiplication Table Generation
Medium
Problem Description
Table Generation with Nested Loops
Outer loop controls rows, inner loop controls columns to generate 2D tables.
Basic Pattern
for (int i = start; i <= end; i++) { // rows
For (int j = start; j <= end; j++) { // columns
System.out.print(i * j);
If (j < end) System.out.print("\t");
}
System.out.println();
}Learning Points
- Outer loop: Row control (vertical)
- Inner loop: Column control (horizontal)
- Delimiter handling: Add delimiter except for last element
- println() for newline, print() for continuous output
Test Cases
※ Output examples follow programming industry standards
Input:
2 4
Expected Output:
4 6 8 6 9 12 8 12 16
Input:
5 5
Expected Output:
25
Input:
1 3
Expected Output:
1 2 3 2 4 6 3 6 9
❌ 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
