006-002-003

Nested Loops: Multiplication Table Generation

Medium

Problem Description

In this problem, you will create a program that uses nested loops to control rows and columns, generating a 2D multiplication table with tab-separated i * j products for each cell, and displays the result to standard output.

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

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up