lundi 2 mars 2015

Java nested for while loops

I am having troubles with nested while loops in a for loop. I understand the nested for loop:



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


When it comes to a while loop inside a for loop I'm kinda lost, can someone explain it to me?



Expected output:
*****
****
***
**
*

Aucun commentaire:

Enregistrer un commentaire