using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 斐波那契数列求和 { class Program { static void Main(string[] args) { Console.WriteLine()); Console.WriteLine()); Console.WriteLine()…
斐波拉契数列是指这样一个数列: F(1)=1; F(2)=1; F(n)=F(n-1)+F(n); public class Solution { public int Fibonacci(int n) { int preNum = 1; int prePreNum = 0; int result = 0; if(n ==0){ return 0; } if(n == 1){ return 1; } for(int i = 2; i <= n; i ++){ result = preNum +…