Home » Java program to print the following pattern on the console 11

Java program to print the following pattern on the console 11

by Online Tutorials Library

Java program to print the following pattern on the console

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

Algorithm:

  • STEP 1: START
  • STEP 2: SET n=5.
  • STEP 3: SET i=0. REPEAT STEP 4 to STEP 8 UNTIL i<=n.
  • STEP 4: SET j=0.REPEAT STEP 5 to STEP 6 UNTIL j
  • STEP 5: PRINT j+1
  • STEP 6: SET j=j+1
  • STEP 7: PRINT new line.
  • STEP 8: SET i=i+1.
  • STEP 9: END

Program:

Output:

1  1 2  1 2 3  1 2 3 4  1 2 3 4 5  
Next TopicJava Programs

You may also like