Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Problem: fb_series
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { static int fibonacci(int n) { int a = 0, b = 1, c; if (n == 0) return a; for (int i = 2; i <= n; i++) { c = a + b; a = b; b = c; } return b; } public static void main (String args[]) { int input = 5; System.out.println(fibonacci(input)); } }
run
|
edit
|
history
|
help
0
Split
jb7.0 extends.override
ex25
Prime Factors
Problem: rstring
MAP List Iterator
Strings Ops
Bubble Sort Java
1d
An excursion with Strings