public static void StarPyramid(int n)
{
for (int i = 0; i < n; i++)
{
var bol = true;
for (int j = 0; j < 2*n; j++)
{
if(j+i>=n && j<=n+i)
{
if(bol)System.out.print("*");
else System.out.print(" ");
bol=!bol;
}
else System.out.print(" ");
}
System.out.println();
}
}
//for n =7
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *