*.
.
*....
.
*....*
......*...
.
*....
......*...
........*....*....
*.
.
*....
.
*....*
......*...
.
*....
......*...
........*....*....
class Untitled {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++)
{
for (int j = 0; j < i; j++)
{
for (int k = 0; k < j; k++)
{
System.out.print("*");
for (int l = 0; l < j; l++) System.out.print(".");
}
System.out.println();
}
System.out.println();
}
}
}
结果:
*.
*.
*..*..
*.
*..*..
*...*...*...
*.
*..*..
*...*...*...
*....*....*....*....