Latest :

Left Arrow Star Pattern Java Program – Patterns

Java program to print Left Arrow star pattern program. We have written below the print/draw Left Arrow asterisk/star pattern program in four different ways with sample example and output, check it out. At the end of the program, we have added compiler so that you can execute the below codes – List of Complete Pattern Programs in Java here.

  • Print Left Arrow Star Pattern – Using For Loop
  • Print – Using While Loop
  • Print – Using Do While Loop

Using For Loop

1) First, for loop displays, the upper pattern of “left arrow” and 2nd for loop displays the lower pattern.

2) First checks the condition i<n at for loop, if it is true, then it executes the first inner for the loop until the condition is false, after that, it executes the 2nd inner for the loop until the condition is false.

3) The 1st inner for loop display space and the 2nd inner for loop displays character which we have given to display.

4) After execution of 1st outer for loop, the 2nd outer for loop will be executed.

5) Checks the condition at for loop, if it is true, then executes the inner loops until the condition i<n.

1st inner loop displays the space and 2nd inner loop displays the character which we have given to display.

Output:

Using While Loop

1) First checks the condition i<=n at while, if it is true then it executes the code in while loop.

2) First, while will executes until i<=n is false.

3) After execution of first while loop 2nd while loop will be executed.

Output:

Using Do-While Loop

1) At first, the do-while loop will be executed until the condition is false i<=n. Inner do-while loops will be executed until the condition is false.

2) After execution of the first do-while loop, the 2nd do-while loop will be executed until the condition i<n is false. Inner do-while loops will be executed until the condition is false.

Output:

More Programs:

x

Check Also

Java Inverted Mirrored Right Triangle Star Pattern

Java program to print Inverted mirrored right triangle star pattern program. We have written below ...