Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FibonacciNumber {
- public static long fibonacci(int K) {
- if(K<=0){
- return 0;
- }
- if(K==1){
- return 1;
- }
- return fibonacci(K-1)+fibonacci(K-2);
- }
- public static void main(String args[]){
- int n=7;
- System.out.println(fibonacci(n));
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment