Multiplication Table

This program prints multiplication table of 5 using for loop.

Problem Statement

Write a Java program that prints multiplication table of 5 using for loop.

Source Code

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

Program Output

5 x 1 = 5 - Eduinq
...
5 x 10 = 50 - Eduinq

Explanation

The program uses a for loop to multiply num by values from 1 to 10. Each iteration prints the result. This demonstrates how loops can generate multiplication tables. Shows how for loop can print multiplication tables.

Quick Links to Explore