Bug: An elusive creature living in a program that makes it incorrect. The activity of "debugging", or removing bugs from a program, ends when people get tired of doing it, not when the bugs are removed.

You are given an integer, N. Write a program to determine if N is an element of the Fibonacci sequence.

The first few elements of the Fibonacci sequence are 0,1,1,2,3,5,8,13,⋯. A Fibonacci sequence is one where every element is a sum of the previous two elements in the sequence. The first two elements are 0 and 1.

Formally:

fib0fib1⋮fibn=0=1=fibn−1+fibn−2∀n>1

Input Format
The first line contains T, number of test cases. T lines follow. Each line contains an integer N.

Output Format
Display IsFibo if N is a Fibonacci number and IsNotFibo if it is not. The output for each test case should be displayed in a new line.

Constraints 1≤T≤105 1≤N≤1010

Sample Input

3
5
7
8

Sample Output

IsFibo
IsNotFibo
IsFibo
Explanation:
A number is Fibonacci number is (5n^2 + 4) or (5n^2 - 4) is perfect square.

class Is_Fibo
{
static void Main(string[] args)
{
int T = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < T; ++i)
{
var N = Convert.ToInt64(Console.ReadLine());
bool isFibo = CheckisFibo(N);
Console.WriteLine(isFibo? "IsFibo" : "IsNotFibo");
}
}

I'm working as Project Lead in Oracle. I'm mainly into Microsoft technologies but quite interested in Java and C. I'm not a professional blogger, whatever I find interesting I read it and write a blog post just to share my understanding.
View all posts by Sunil Kumar