📜  fibonacci js 代码 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:18.978000             🧑  作者: Mango

代码示例6
function fibonacci(num){ 
    var num1=0; 
    var num2=1; 
    var sum; 
    var i=0; 
    for (i = 0; i < num; i++){ 
        sum=num1+num2; 
        num1=num2; 
        num2=sum; 
    } 
    return num2; 
}