JS- Fibonacci number: 0,1,1,2,3,5,8,13 ....

JS- Fibonacci number: 0,1,1,2,3,5,8,13 ....

Enter a Fibonacci number judgment on the deed for the number of bits that much

The require the Read = let ( "readline-Sync" ) 
console.log ( "Fibonacci number of bits" ) 
let POS = parseInt (read.question ( "" )) 
let num1 = 0; // first 
let =. 1 num2; // second 
the let TEMP = 0; // temporary variables 
for (I = the let. 3; I <POS; I ++ ) { 
    TEMP = num2; 
    num2 = + num1 num2; 
    num1 = TEMP; 
} 
the console.log ( "Fibonacci on the number of bits that deed is:", num2)

 

Guess you like

Origin www.cnblogs.com/gao7/p/11120356.html