C#迭代器实现斐波那契数列
2021-03-11 05:31
标签:斐波那契 for style col bsp 数列 count rev 斐波那契数列 C#迭代器实现斐波那契数列 标签:斐波那契 for style col bsp 数列 count rev 斐波那契数列 原文地址:https://www.cnblogs.com/aqgy12138/p/12642189.html static IEnumerableint> Fibs(int count)
{
for (int i = 0,prevFib=1,curFib=1; i )
{
yield return prevFib;
int newFib = prevFib + curFib;
prevFib = curFib;
curFib = newFib;
}
}
上一篇:drf-apiview解读系列一