Multiplication Table Grid
This program prints multiplication tables from 1 to 3 in grid form.
Problem Statement
Write a Java program that prints multiplication tables from 1 to 3 using nested for loop.
Source Code
| 1 | public class MultiplicationGrid { |
| 2 | public static void main(String[] args) { |
| 3 | for(int i=1; i<=3; i++) { |
| 4 | for(int j=1; j<=10; j++) { |
| 5 | System.out.println(i + " x " + j + " = " + (i*j) + " - Eduinq"); |
| 6 | } |
| 7 | System.out.println(); |
| 8 | } |
| 9 | } |
| 10 | } |
Program Output
1 x 1 = 1 - Eduinq ... 3 x 10 = 30 - Eduinq
Explanation
The outer loop iterates through numbers 1 to 3. The inner loop prints multiplication table for each number. This demonstrates nested loops for generating multiple tables. Shows how nested for loops can generate multiplication table grids.