int n = 10; for (int i = 1; i <= n; i++) { Console.Write(new string(‘ ‘, n - i)); for (int j = 1; j <= i - 1; j++) Console.Write(" *"); Console.Write("\n"); } Console.ReadKey();
时间: 2024-11-08 03:23:20
int n = 10; for (int i = 1; i <= n; i++) { Console.Write(new string(‘ ‘, n - i)); for (int j = 1; j <= i - 1; j++) Console.Write(" *"); Console.Write("\n"); } Console.ReadKey();