vendredi 3 septembre 2021

In this pattern I cannot Understand, how the Space has been printed?

class Pattern02 { public static void main(String args[]){

int n = 5;

for( int i=1; i<=n; i++){

 for(int j=1; j<=i-1; j++){ 

    System.out.print("  ");
 }
 for(int k=n; k>=i; k--){
   
    System.out.print("* ");     
 }
 
 System.out.println();

}

} }

Aucun commentaire:

Enregistrer un commentaire