109,897
社区成员




using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
画三角形(1, 1, 1, 15);
Console.ReadKey();
}
private static void 画三角形(int x, int y, int a, int n)
{
begin:
for (var i = 0; i < n - 1; i++)
输出(x, y++, a++);
for (var i = 0; i < n - 1; i++)
输出(x++, y, a++);
for (var i = 0; i < n - 1; i++)
输出(x--, y--, a++);
n -= 3;
if (n > 0)
{
x++;
y += 2;
goto begin;
}
}
private static void 输出(int x, int y, int a)
{
Console.CursorLeft = x * 4;
Console.CursorTop = y * 2;
Console.Write(a);
}
}
}