五角星循环重难点!!!
static void Main(string[] args)
{
while (true)
{
/*★
★★ //最重要的就是找规律 i--行
★★★ j--列
★★★★
★★★★★
*/
/*string s = "★";
int n;
Console.WriteLine("请输入一个数:");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <=i; j++)
{
Console.Write(s);
}
Console.WriteLine();
}
*/
/*★★★★★
★★★★
★★★
★★
★
*/
/* string s = "★";
int n;
Console.WriteLine("请输入一个数:");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <=n+1-i; j++)
{
Console.Write(s);
}
Console.WriteLine();
}
*/
/*
★
★★
★★★
★★★★
★★★★★
*/
/*
string s = "★";
int n;
Console.WriteLine("请输入一个数:");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i<=n; i++)
{
for (int j = 1; j <=(n-i); j++)
{
Console.Write(" ");
}
for (int t = 1; t <=i ; t++)
{
Console.Write(s);
}
Console.WriteLine("");
}
*/
/*
★
★★★
★★★★★
★★★★★★★
★★★★★★★★★
*/
/*
string s = "★";
int n;
Console.WriteLine("请输入一个数:");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <=n; i++)
{
for (int j = 1; j <=(n-i); j++)
{
Console.Write(" ");
}
for (int t = 1; t<=(2*i-1);t++)
{
Console.Write(s);
}
Console.WriteLine();
}
*/
/*
★
★★
★★★
★★★★
★★★★★
★★★★
★★★
★★
★
*/
/* string s = "★";
int n;
Console.WriteLine("请输入一个数:");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <=n; i++)
{
for (int b = 1; b <=n-i; b++)
{
Console.Write(" ");
}
for (int j= 1; j <=i; j++)
{
Console.Write(s);
;
}
Console.WriteLine();
}
for (int p = 1; p <=n; p++)
{
for (int o = 1; o <=p; o++)
{
Console.Write(" ");
}
for (int k = 1; k <=n-p; k++)
{
Console.Write(s);
}
Console.WriteLine();
}
Console.WriteLine();
/*
★
★★★
★★★★★
★★★
★
*/
string s = "★";
int n;
Console.WriteLine("请输入一个数:");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <=n; i++)
{
for (int x = 1; x <=n-i; x++)
{
Console.Write(" ");
}
for (int y = 1; y <=2*i-1; y++)
{
Console.Write(s);
}
Console.WriteLine();
}
for (int t = 1; t <n; t++)
{
for (int z = 1; z <=t; z++)
{
Console.Write(" ");
}
for (int q = 1; q <=2*(n-t)-1; q++)//最重要的公式!!
{
Console.Write(s);
}
Console.WriteLine();
}
/*
★★
★★★
★★★★
★★★★★
*/
/*string s = "★";
int n;
Console.WriteLine("请输入一个数(大于4):");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 4; i <= n; i++)
{
for (int j = 1; j <= (n - i); j++)
{
Console.Write(" ");
}
for (int t = 1; t <= (2 * i-1); t++)
{
Console.Write(s);
}
Console.WriteLine();
}
*/
/* ★★★★★★
★★★★★★★
★★★★★★★★
★★★★★★★★
★★★★★★★★
★★★★★★★★
★★★★★★★
★★★★★★
*/
/*string s = "★";
int n;
Console.WriteLine("请输入一个数:");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <=n; i++)
{
for (int j = 1; j <= n; j++)
{
if (i == 1 && j == 1||i==1&&j==2||i==2&&j==1||i==(n-1)&&j==n||i==n&&j==(n-1)||i==n&&j==n)
{
Console.Write(" ");
}
else
{
Console.Write(s);
}
}
Console.WriteLine();
}*/