mardi 6 janvier 2015

Java half triangle program



package halfpyramid;

public class Half_pyramid {

public static void main(String[] args) {
int x,y,n=5;
for(x=1;x<n;x++)
{
for(y=1;y<=x;y++)
System.out.println("*");
System.out.println("");
}
}
}


This code doesn't produce a meaningful output like



*

**

***

****


It creates something like this



*

*
*

*
*
*

*
*
*
*




Aucun commentaire:

Enregistrer un commentaire