Skip to content

a-shina/Fibonacci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This java program generates fibonacci sequence using tail recursion, since it is faster and more efficient than regular recursion. Using my variables of n, x, y, when we pick a number for n to calculate the fibonacci number, x starts at 0 and y starts at 1 respectively. As n decreases by 1 in every recursive call, x changes to y of (n + 1) and y changes to the sum of x and y of (n + 1). As this process continues, when n becomes 1, the program returns y as the answer for our fibonacci number.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages