import java.util.*;
class Fibbonacci {
static int fib(int n) {
if(n==0) return
(0);
else if(n==1) return
(1);
else return
(fib(n-1)+fib(n-2));
}
public static void main(String args[]){
System.out.println("enter last number");
int n=new Scanner(System.in).nextInt();
System.out.println("fibonacci series is as follows");
int res=0;
for(int i=0;i<=n;i++) {
res=fib(i);
System.out.println(" "+res);
}
}
}
Output: