1,1,2,3,5,8,13...按照这个规律求33位的数字是多少

using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Program pro = new Program(); int count = int.Parse(Console.ReadLine()); Console.WriteLine(pro.work(30)); Console.ReadKey(); } //1,1,2,3,5,8,13... //假设n=30 int work(int n) { if (n <= 2) { return 1; } else { return work(n - 1) + work(n - 2); } } } }

你可能感兴趣的:(String,Class)