Check the following program based on property n is Fibinacci if one of 5*n*n + 4 or 5*n*n - 4 or both is a perfect square
bool isPerfectSquare(int x)
{
int s = sqrt(x);
return (s*s == x);
}
bool isFibonacci(int n)
{
return isPerfectSquare(5*n*n + 4) ||
isPerfectSquare(5*n*n - 4);
}