2个回答
展开全部
int a, b, c, i;
Console.Write("请输入菱形的大小:");
i=int.Parse(Console.ReadLine());
for (a = 0; a < i; a++)
{
Console.Write(" ");
}
Console.Write("* ");
Console.Write("\n");
for (a = 1; a <= i; a++)
{
for (b = 0; b < i - a; b++)
{
Console.Write(" ");
}
Console.Write("*");
for (b = 0; b < 2 * a - 1; b++)
{
Console.Write(" ");
}
Console.Write("*");
Console.Write("\n");
}
for (a = 1; a <= i - 1; a++)
{
for (b = 0; b < a; b++)
{
Console.Write(" ");
}
Console.Write("*");
for (b = 0; b < 2 * i - 2 * a - 1; b++)
{
Console.Write(" ");
}
Console.Write("*");
Console.Write("\n");
}
for (c = 1; c < i + 1; c++)
{
Console.Write(" ");
}
Console.Write("*\n");
这个是空心的。可以随便输入大小
Console.Write("请输入菱形的大小:");
i=int.Parse(Console.ReadLine());
for (a = 0; a < i; a++)
{
Console.Write(" ");
}
Console.Write("* ");
Console.Write("\n");
for (a = 1; a <= i; a++)
{
for (b = 0; b < i - a; b++)
{
Console.Write(" ");
}
Console.Write("*");
for (b = 0; b < 2 * a - 1; b++)
{
Console.Write(" ");
}
Console.Write("*");
Console.Write("\n");
}
for (a = 1; a <= i - 1; a++)
{
for (b = 0; b < a; b++)
{
Console.Write(" ");
}
Console.Write("*");
for (b = 0; b < 2 * i - 2 * a - 1; b++)
{
Console.Write(" ");
}
Console.Write("*");
Console.Write("\n");
}
for (c = 1; c < i + 1; c++)
{
Console.Write(" ");
}
Console.Write("*\n");
这个是空心的。可以随便输入大小
展开全部
for(int i=1;i<5;i++){
for(int j=1;j<=5-i;j++)
Console.Write(" ");
for(int k=1;k<=i*2-1;k++)
Console.Write("*");
Console.WriteLine("");
}
for(int i=1;i<=3;i++){
for(int j=0;j<=i;j++)
Console.Write(" ");
for(int k=1;k<=7-2*i;k++)
Console.Write("*");
Console.WriteLine("");
for(int j=1;j<=5-i;j++)
Console.Write(" ");
for(int k=1;k<=i*2-1;k++)
Console.Write("*");
Console.WriteLine("");
}
for(int i=1;i<=3;i++){
for(int j=0;j<=i;j++)
Console.Write(" ");
for(int k=1;k<=7-2*i;k++)
Console.Write("*");
Console.WriteLine("");
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询