1 Console.Write("请输入一个数:"); 2 int n = int.Parse(Console.ReadLine()); 3 for (int i = 1; i <= n; i++) 4 { 5 for (int b = 1; b <= n - i; b++) 6 { 7 Console.Write(" "); 8 } 9 for (int j = 1; j <= 2 * i - 1; j++) 10 { 11 Console.Write("☆"); 12 } 13 Console.Write("\n"); 14 } 15 for (int p = 1; p <= n; p++) 16 { 17 for (int o = 1; o <= p; o++) 18 { 19 Console.Write(" "); 20 } 21 for (int k = 1; k <= 2 * (n - p) - 1; k++) 22 { 23 Console.Write("☆"); 24 } 25 Console.Write("\n"); 26 } 27 28 Console.ReadLine();
时间: 2024-10-01 06:33:53