/**
* FibonacciSeries using recursion
*/
package com.konzerntech.kozhikode;
/**
* @author Alwin
*
*/
public class FibonacciSeries {
/**
* @param args
*/
public static void main(String[] args) {
FibonacciSeries f = new FibonacciSeries();
int count = 49;
int first = 0;
int second = 1;
f.fibonacci(first, second, count);
}
private void fibonacci(int first, int second, int count) {
if (count != 0) {
System.out.print(first + " ");
fibonacci(second, first + second, count - 1);
}
}
}
* FibonacciSeries using recursion
*/
package com.konzerntech.kozhikode;
/**
* @author Alwin
*
*/
public class FibonacciSeries {
/**
* @param args
*/
public static void main(String[] args) {
FibonacciSeries f = new FibonacciSeries();
int count = 49;
int first = 0;
int second = 1;
f.fibonacci(first, second, count);
}
private void fibonacci(int first, int second, int count) {
if (count != 0) {
System.out.print(first + " ");
fibonacci(second, first + second, count - 1);
}
}
}
No comments:
Post a Comment
Your feedback may help others !!!