标签:
菱形+数兔子
Console.Write("请输入一个数字:");
int a = int.Parse(Console.ReadLine());
for (int i = 1; i <= (a + 1); i++)
{
for (int l = i; l <= a; l++)
{
Console.Write(" ");
}
for (int l = 1; l <= i; l++)
{
Console.Write("★");
}
Console.WriteLine();
}
for (int i = 1; i <= a; i++)
{
for (int l = 1; l <= i; l++)
{
Console.Write(" ");
}
for (int l = a; l >= i; l--)
{
Console.Write("☆");
}
Console.WriteLine();
}
Console.Write("请输入月数:");
int a = int.Parse(Console.ReadLine());
int b = 1, c = 0, d = 0, e = 0;
for (int i = 1; i <= a; i++)
{
if (i == 1)
{
b = 1;
c = 0;
d = 0;
}
else
{
d = d + c;
c = b;
b = d;
}
}
e = b + d + c;
Console.Write("幼兔的个数是:" + b);
Console.Write("小兔的个数是:" + c);
Console.Write("成兔的个数是:" + d);
Console.Write("兔的总个数是:" + e);
标签:
原文地址:http://www.cnblogs.com/mazhijie/p/5456532.html