Skip to content

Inverted Pyramid

Upside-down half-pyramid of stars.

package DSA.Patterns;
public class invertedPyraMID {
public static void invert(int a) {
for (int i = 1; i <= a; i++) {
for (int j = 1; j <= a - i; j++) {
System.out.print(" ");
}
for (int k = 1; k <= i; k++) {
System.out.print("*");
}
System.out.println();
}
}
public static void main(String[] args) {
invert(4);
}
}