|
本帖最后由 孤星11 于 2022-11-20 15:17 编辑
我的答案:
https://dotnetfiddle.net/he3IMg
- using System;
-
- public class Program
- {
- public static void Main()
- {
- int size=6;
-
- for (int a=1; a<size; a++)
- {
- for (int b=size; b>a; b--)
- Console.Write(" ");
- Console.Write("*");
- for (int c=3; c<a*2; c++)
- Console.Write(" ");
- if (a>1)
- Console.WriteLine("*");
- else
- Console.WriteLine();
- }
- for (int a=size-2; a>0; a--)
- {
- for (int b=size; b>a; b--)
- Console.Write(" ");
- Console.Write("*");
- for (int c=3; c<a*2; c++)
- Console.Write(" ");
- if (a>1)
- Console.WriteLine("*");
- else
- Console.WriteLine();
- }
- }
- }
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|