java nth fibonacci number
// Using following formula you can find nth Fibonacci Number without using any loops;
// Created by using resources from " https://math.hmc.edu/funfacts/fibonacci-number-formula/ "
class Find
{
public int nFibo(int n)
{
double Phi=((1+Math.sqrt(5))/2);
double phi=((1-Math.sqrt(5))/2);
int ans=(int)((Math.pow(Phi,n)-(Math.pow(phi,n)))/Math.sqrt(5));
return ans;
}
}