Here's the pattern:
*******
*****
***
*
**
***
*****
********
Here's the code I used to get only the first part(the up-side down triangle):
class hourglass
{
static void pattern()
{
for(int j=1;j<=4;j++)
{
for(int i=1;i<=j;i++)
{
System.out.print(" ");
}
for(int i=7;i>j;i--)
{
System.out.print("*");
}
System.out.println();
}
}
}
It isn't working, can anybody help?