using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 习题5
{
class Program
{
static void Main(string[] args)
{
//打印方形,每行打印10个“A”,打印10行,使用循环嵌套,不允许定义内容为“AAAAAAAAAA”的变量;
for (int i=1;i<=10;i++)
{
for (int b = 1; b <= 10;b ++ )
{
Console.Write("A");
}
Console.WriteLine();
}
Console.ReadLine();
// 打印三角形
//*
//**
//***
//****
//*****
//*****
//****
//***
//**
//*
//1111*
//111**
//11***
//1****
//*****
//*****
// ****
// ***
// **
// *
// *
// ***
// *****
// *******
// *
// ***
// *****
// *******
// *****
// ***
// *
//1
for(int a = 1; a <= 5; a++)
{
for (int b = 1; b <= a; b++)
{
Console.Write("★");
}
Console.WriteLine();
}
Console.ReadLine();
////2
for (int c = 1; c <= 5; c++)
{
for (int d = 5; d >= c; d--)
{
Console.Write("★");
}
Console.WriteLine();
}
Console.ReadLine();
//3
for (int a = 1; a <= 5; a++)
{
for (int k = 4; k >= a; k--)
{
Console.Write(" ");
}
for (int b = 1; b <= a; b++)
{
Console.Write("★");
}
Console.WriteLine();
}
Console.ReadLine();
//4
for (int a = 1; a <= 5; a++)
{
for (int k = 1; k < a; k++)
{
Console.Write(" ");
}
for (int b = 5; b >= a; b--)
{
Console.Write("★");
}
Console.WriteLine();
}
Console.ReadLine();
//5
for (int a = 1; a <= 4; a++)
{
for (int b = 1; b <= 4 - a; b++)
{
Console.Write(" ");
}
for (int c = 1; c <= 2 * a - 1; c++)
{
Console.Write("★");
}
Console.WriteLine();
}
// 6
for (int a = 1; a <= 4; a++)
{
for (int b = 1; b <= 4 - a; b++)
{
Console.Write(" ");
}
for (int c = 1; c <= 2 * a - 1; c++)
{
Console.Write("★");
}
Console.WriteLine();
}
for (int p = 1; p < 4; p++)
{
for (int o = 1; o <= p; o++)
{
Console.Write(" ");
}
for (int k = 1; k <= 2 * (4 - p) - 1;k++ )
{
Console.Write("★");
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}