Fibonacci para Biginteger
import java.math.BigInteger;
import java.util.Scanner;
public class FibonacciRecursion {
public static BigInteger fibonacci(int n) {
if (n == 1 || n == 2) {
return BigInteger.ONE;
}else if(n==0){
return BigInteger.ZERO;
}
else {
return (fibonacci(n - 1).add(fibonacci(n - 2)));
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
BigInteger ans = fibonacci(n);
System.out.println(ans);
}
}
Techie Ash