Fibonacci Using Recusion method:
package diamond;import static diamond.Fibonacci.fibonacciRecusion;
public class FibonacciDemo {
public static void main(String[] args) {
System.out.println("\nFibonacci by recusion");
int febCount=15;
for(int i=1; i<=febCount; i++){
System.out.print(fibonacciRecusion(i) +" ");
}
}
}
The output of this program is as:
Fibonacci by recusion
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610
0 comments:
Post a Comment