KnowledgeBoat Logo

Java Pattern Programs

Write a program in Java to display the following pattern:

3
44
555
6666
77777

Java

Java Nested for Loops

ICSE

38 Likes

Answer

public class KboatPattern
{
    public static void main(String args[]) {
        for (int i = 3; i <= 7; i++) {
            for (int j = 3; j <= i; j++)
                System.out.print(i);
            System.out.println();
        }
    }
}

Output

BlueJ output of Write a program in Java to display the following pattern: 3 44 555 6666 77777

Answered By

20 Likes