using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 字符圖案輸出
{
class Program
{
static void Main(string[] args)
{
bool b = true;
while (b == true)
{
try//判斷數據是否合法↓
{
Console.Write("請輸入壹個奇數: ");
int n = Convert.ToInt32(Console.ReadLine());
if (n % 2 == 0)
{
continue;
}
for (int i = 1; i <= (2 * n) -1; i++)
{
for (int j = 1; j <= Math.Abs(n - i); j++)//絕對值實現對稱, 如:3210123,想想,◆是不是先輸出空格,並逐行減少, 後逐行增多
{
Console.Write(' ');
}
for (int k = 1; k <= Math.Abs(n - Math.Abs(n - i)); k++)//同理,◆第壹行輸出1個*,後逐行增多,然後又逐行減少
{
Console.Write("* ");//如果*後沒有空格,則是半個菱形
}
Console.WriteLine();
}
}
catch
{
b = true;
}
}
}
}
}