static void Main22(string[] args)
{
//菱形
Console.WriteLine("请输入腰长:");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i <n; i++)
{
for (int j = 0; j <n-i; j++)
{
Console.Write(" ");
}
for (int k =0; k <2*i-1; k++)
{
Console.Write("★");
}
Console.Write("
");
}
for (int l = 0; l <=n; l++)
{
for (int m = 0; m <l; m++)
{
Console.Write(" ");
}
for (int o = 2*n-1; o >2*l; o--)
{
Console.Write("★");
}
Console.Write("
");
}
}
static void Main14(string[] args)
{
//右上等腰直角三角形
Console.WriteLine("请输入腰长:");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i <=n; i++)
{
for (int k = 0; k < i; k++)
{
Console.Write(" ");
}
for (int j = n; j > i; j--)
{
Console.Write("★");
}
Console.Write("
");
}
}
static void Main13(string[] args)
{
//右下等腰直角三角形
Console.WriteLine("请输入腰长:");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i<n; i++)
{
for (int k = 1; k <n-i; k++)
{
Console.Write(" ");
}
for (int j = 0; j <=i; j++)
{
Console.Write("★");
}
Console.Write("
");
}
}
static void Main12(string[] args)
{
//左上等腰直角三角形
Console.WriteLine("请输入腰长:");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = n; i >=0; i--)
{
for (int j = 0; j < i; j++)
{
Console.Write("★");
}
Console.Write("
");
}
}
static void Main11(string[] args)
{
//左下等腰直角三角形
Console.WriteLine("请输入腰长:");
int n = Convert.ToInt32(Console .ReadLine());
for (int i = 0; i <= n; i++)
{
for (int j = 0; j < i; j++)
{
Console.Write("★");
}
Console.Write("
");
}
}
#region*****循环练习*****
static void Main5(string[] args)
{
int j = 1;
for (int i = 6; i >0; i--)
{
j = j*i;
}
Console.Write(j);
}
static void Main4(string[] args)
{
for (int i = 1; i < 100; i++)
{
if (i%7==0||i%10==7||i/10==7)
Console.Write("{0} ",i);
}
}
static void Main3(string[] args)
{
for (int i = 0; i < 128; i++)
{
Console.Write((char)i+"={0} ",i);
}
}
static void Main2(string[] args)
{
for (int i = 1; i < 51; i++)
{
int j = 2 * i - 1;
Console.Write("{0} ",j);
}
}
static void Main1(string[] args)
{
Console.Write("这是一个");
for (int i = 1; i <= 100; i++)
{
Console.Write("非常");
}
Console.Write("长的句子");
}
#endregion
//斐波那契数列
static void Main(string[] args)
{
int b=1;
int c=0;
int d=0;
for (int a = 1; a < 24; a++)
{
d = b + c;
b = c;
c = d;
Console.Write("{0} ",d);
}
}
//猴子吃桃子
static void Main32(string[] args)
{
int b=1;
for (int a = 1; a < 7; a++)
{
b = (b + 1) * 2;
}
Console.Write("原有{0}个桃子", b);
}
static void Main31(string[] args)
{
for (int a = 0; a <= 20; a++)
{
for (int b = 0; b <= 50; b++)
{
for (int c = 0; c <= 7; c++)
{
if (5 * a + 2 * b + 15 * c == 100)
Console.WriteLine("购买{0}支牙刷,{1}块肥皂,{2}瓶洗发水",a,b,c);
}
}
}
}
static void Main1111111111111(string[] args)
{
//100以内的质数
for (int i = 2; i < 100; i++)
{
bool a = true;
for (int j = 2; j <=Math .Sqrt( i); j++)
{
if (i % j == 0)
{
a=false;
break;
}
}
if (a)
Console.Write("{0} ", i);
}
}