Dremendo Tag Line

Print the given pattern in Java

Java Output - Question 5

In this question, we will see how we can print the given pattern in java programming using the java output. To know more about java output click on the java output lesson.

Q5) Write a program in java to print the given pattern using java output on the screen.

5
45
345
2345
12345

Program

public class Q5
{
    public static void main(String args[])
    {
        System.out.println("5");
        System.out.println("45");
        System.out.println("345");
        System.out.println("2345");
        System.out.println("12345");
    }
}

Output

5
45
345
2345
12345
video-poster