</> ᴍᴜᴋᴇsʜ </>
Inverted half pyramid of number .
public class invertedpyra {
public static void Inverted_half_pyramid(int n) {
for (int i = 1; i <= n; i++) {
// inner loop
for (int j = 1; j <= n - i + 1; j++) {
System.out.print(j);
}
System.out.println();
}
}
public static void main(String[] args) {
Inverted_half_pyramid(6);
}
}
Output:
123456
12345
1234
123
12
1
2 · 1.2K ·