0

How to print inverted number pattern in java?

4444 333 22 1

18th Feb 2019, 3:08 PM
Krishna Pandit
Krishna Pandit - avatar
2 Respuestas
+ 1
Please show us your attempt first. I'll give you a clue, one way to do this is to create 2 loops. One loop for printing the values and another one to check how many times are needed to print the values.
18th Feb 2019, 5:13 PM
Lambda_Driver
Lambda_Driver - avatar
0
for (int i = 4; i >= 1; i--) { for (int j = 1; j <= i; j++){ System.out.print(i); } System.out.println(); }
18th Feb 2019, 8:36 PM
JavaBobbo
JavaBobbo - avatar