1class Main
2{
3 // Function to find the nth Fibonacci number
4 public static int fib(int n)
5 {
6 if (n <= 1) {
7 return n;
8 }
9
10 return fib(n - 1) + fib(n - 2);
11 }
12
13 public static void main(String[] args)
14 {
15 int n = 8;
16
17 System.out.println("nth Fibonacci number is " + fib(n));
18 }
19}