dimanche 23 juin 2019

how to print this pattern in java i have no idea how

i cant print this pattern : 1 2 3 4 * 1 0 0 * 5 1 0 * 0 5 1 * 0 0 5 * 2 3 4 5

i tried to print but only on row :

public class Pattern {

public static void main(String[] args) { 
        for(int j=1;j<=5;j++)
        {
            if(j>4) {
                System.out.print("*");
            }
            else {
                System.out.print(j);

            }
        }
}

}

Aucun commentaire:

Enregistrer un commentaire