In this tutorial, we are going to write a Java program to print a star pattern in a reverse pyramid shape in java Programming with practical program code and step-by-step full complete explanation.
Java program to print star a pattern in a reverse pyramid shape.
class Pattern6 { public static void main(String args[]) { int sp=20; for(int i=5;i>=1;i--) { for(int k=5;k<=sp;k++) { System.out.print(" "); } sp++; for(int j=1;j<=i;j++) { System.out.print("* "); } System.out.println(); } } }
Output
* * * * * * * * * * * * * * *