-
asterisks triangles
Hi
i have written a program to display a
*****
****
***
**
*
triangle using the code
Code:
String stars = "",star="";
for(int count = 0; count < 5; count++)
{
star=star+"*";
stars = stars + star+System.getProperty("line.separator");
}
return stars;
but i can't figger out how to display a
*****
****
***
**
*
traingle using that code
any help would be be appreshated.
-
Try this:
Code:
String stars = "",star="*****";
for(int count = 5; count > 0; count--)
{
star=star.substring(0, count);
stars = stars + star+System.getProperty("line.separator");
}
return stars;