KnowledgeBoat Logo

Java Pattern Programs

Write a program in Java to display the following pattern:

11
12 22
13 23 33
14 24 34 44
15 25 35 45 55

Java

Java Nested for Loops

ICSE

2 Likes

Answer

public class KboatPattern
{
    public static void main(String args[]) {
        for (int i = 11, j = 1; i <= 15; i++, j++) {
            for (int k = i, l = 1; l <= j; k += 10, l++) {
                System.out.print(k + " ");
            }
            System.out.println();
        }
    }
}

Output

BlueJ output of Write a program in Java to display the following pattern: 11 12 22 13 23 33 14 24 34 44 15 25 35 45 55

Answered By

1 Like