Inverted Half Pyramid with Numbers Output Screenshot
Inverted Half Pyramid with Numbers Pattern Simple Java Code
public class Inverted_Half_Pyramid_with_Numbers {
public static void main(String[] args) {
IHPN(9);
}
public static void IHPN(int n) {
for (int i = 1; i <= n; i++) {
// inner - numbers
for (int j = 1; j <= n - i + 1; j++) {
System.out.print(j);
// System.out.print(j + " ");
}
System.out.println();
}
}
}
No comments:
Post a Comment