1.一数列的规则如下:1、1、2、3、5、8、13、21、34、······求第30位数是多少?
代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Program
{
class Program
{
static void Main(string[] args)
{
int[] a = new int[30];
a[0] = 1;
a[1] = 1;
for (int i = 2; i < 30; i++)
{
a[i] = a[i - 1] + a[i - 2];
}
Console.WriteLine("第三十个数是{0}", a[29]);
Console.ReadKey();
}
}
}
运行结果:
2.输入一个年份,判断是否闰年(被4整除,且不被100整除,或者被400整除&#x