Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(n <= 1){
- return n;
- }
- int fibo = 1;
- int fiboPrev = 1;
- for(int i = 2; i < n; ++i){
- int temp = fibo;
- fibo += fiboPrev;
- fiboPrev = temp;
- }
- return fibo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement