package lx;

public class lx {
	public static void main(String[] args)
	{
		for(int i = 1;i <= 10 ;i++)
		{
			for(int h = 9; h >= i; h--)
			{
				System.out.print(" ");//打印空格,从9个到1个
			}
			for(int x = 1; x <= i; x++)
			{
				System.out.print("*");//打印星号,从1个到9个
			}
			for(int x = 1; x < i; x++)//为了顶部有尖端,右半边第一行不输出,所以用"<"而不是“<=”
			{
				System.out.print("*");//右边部分只输出星号即可
			}			
			System.out.println();//换行
		}
		//以上菱形上半部分,下半部分同理
		for(int i = 1;i <= 10 ;i++)
		{
			for(int x = 1; x <= i; x++)
			{
				System.out.print(" ");
			}
			for(int h = 9; h >= i; h--)
			{
				System.out.print("*");
			}
			for(int h = 9; h > i; h--)
			{
				System.out.print("*");
			}
			System.out.println();
		}
	}

}

  

相关文章:

  • 2022-12-23
  • 2021-11-10
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-08
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案