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

Java program to print the following pattern on the console 3

by Online Tutorials Library

Java program to print the following pattern on the console

Java program to print the following pattern on the console

To accomplish this task, we need to create two loops and the 2nd loop is to be executed according to the first loop. The first loop is responsible for printing the line breaks whereas the second loop is responsible for printing the stars (*).

Algorithm:

  • STEP 1: START
  • STEP 2: DEFINE i,j
  • STEP 3: SET n=7
  • STEP 4: PRINT “Right Angle Triangle”
  • STEP 5: SET i=1.REPEAT STEP 6 to 8 UNTIL i
  • STEP 6: SET j = 1 .REPEAT STEP 7 UNTIL j<=i
  • STEP 7: PRINT * and SET j=j+1
  • STEP 8: PRINT new line and SET i=i+1
  • STEP 9: END

Program:

Output:

Java program to print the following pattern on the console

Next TopicJava Programs

You may also like