Multiplication Tables 1 to 3

This program prints multiplication tables from 1 to 3 using nested for loop.

Problem Statement

Write a Java program that prints multiplication tables from 1 to 3 using nested for loop.

Source Code

1 public class MultiplicationTables {
2 public static void main(String[] args) {
3 for(int num=1; num<=3; num++) {
4 System.out.println("Table of " + num + " - Eduinq");
5 for(int i=1; i<=10; i++) {
6 System.out.println(num + " x " + i + " = " + (num*i));
7 }
8 }
9 }
10 }

Program Output

Table of 1 - Eduinq
1 x 1 = 1
...
Table of 3 - Eduinq
3 x 10 = 30

Explanation

The outer loop iterates through numbers 1 to 3. The inner loop prints multiplication table for each number. This demonstrates how nested loops can generate multiple tables. Shows how nested for loops can print multiple multiplication tables.

Quick Links to Explore