+ 2
It's similar to the way with any other loop structure. This is one simple way to do it: public class Program { public static void main(String[] args) { int size = 5; int row = 0; int col = 0; do { // Print rows do { // Print columns System.out.print(col); col++; } while (col <= row); System.out.println(); // New row col = 0; // Going to the first column row++; } while (row < size); } }
22nd Jan 2018, 12:07 PM
Boris Batinkov
Boris Batinkov - avatar