mardi 27 décembre 2016

Java Pattern with numbers

Hello i need to do the following /* 1234567 123456 12345 1234 123 12 1 */ i need it with a for loop and if statement please. that's the code in stars

for (int i = 0; i <= n; i++) {
        for (int j = n; j >= 0; j--) {
            if (i <= j) {
                System.out.print("*");
            }
        }
        System.out.println("");
    }

Aucun commentaire:

Enregistrer un commentaire