17.2k views
7 votes
JAVA

Write a program to display the given pattern:
3
5 6
8 9 10
12 13 14 15​

User Ntownsend
by
5.6k points

1 Answer

5 votes

Answer:

class Main {

public static void main(String args[]) {

int nr = 1;

int value = 3;

while(value < 16) {

for(int i=0; i<nr; i++) {

System.out.printf("%d ",value++);

}

System.out.println();

value++;

nr++;

}

}

}

Step-by-step explanation:

This is one of the many approaches...

User OldUgly
by
5.5k points