斐波那契数列第30个数是多少?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace consoleapplication1
{
class Program
{
static void Main(string[] args)
{
int[] sum = new int[30];
sum[0] = 1;
sum[1] = 1;
for (int i = 2; i < 30; i++)
{
sum[i] = sum[i - 1] + sum[i - 2];
}
Console.WriteLine(sum[29]);
Console.ReadKey();
}
}
}