</> ᴍᴜᴋᴇsʜ </>
Inverted Half Rotated Pyramid
public class invertrothalfpyramid {
public static void inverted_half_pyramid(int n) {
// outer loop
for (int i = 1; i <= n; i++) {
// empty space
for (int j = 1; j <= n - i; j++) {
System.out.print(" ");
}
// star
for (int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();
}
}
public static void main(String[] args) {
// InvertedHalfPiramid(4, 4);
inverted_half_pyramid(4);
}
}
Output:
*
**
***
****
2 · 1.4K ·