Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fibonacci javascript


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; 
} 
Source by ide.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #fibonacci #javascript
ADD COMMENT
Topic
Name
8+9 =