Java Program to Print Multiplication Table Triangle Pattern

  • How to print a multiplication table triangle pattern in Java.

package com.tcc.java.programs;

import java.util.*;

public class MultiplicationTableTrianglePattern {
    public static void main(String args[]) {
        int rows, i, j;

        Scanner in = new Scanner(System.in);
        System.out.println("Enter number of rows in pattern");
        rows = in.nextInt();

        for (i = 0; i < rows; i++) {
            for (j = 0; j <= i; j++) {
                System.out.print(i*j + " ");
            }
            System.out.print("\n");
        }
    }
}
Output
Enter number of rows in pattern
6
0 
0 1 
0 2 4 
0 3 6 9 
0 4 8 12 16 
0 5 10 15 20 25

Recommended Posts
Java Program to Print Multiplication Table of Number
Java Program to Print Inverted Right Triangle Star Pattern
Java Program to Print Pascal Triangle
Java Program to Print Right Triangle Star Pattern
Java Program to Print Diamond Pattern of Star Character
Java Program to Print Right Triangle Pattern of Natural Numbers
Java Program to Print Inverted Pyramid Pattern of Stars
Java Program to Print Pyramid Pattern of Stars
Java program to Print Square Pattern of Star Character
Java Program to Count Words in a Sentence
Java Program to Check Whether two Strings are Equal or Not
All Java Programs