Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

You are given an integer, all you have to do is to find whether this number is a Fibonacci number or not.

Fn is said to be a Fibonacci sequence such that each number in Fn is the sum of its two preceding numbers, starting with 0 and 1.

```
Fn = F(n-1) + F(n-2)
```

fn is said to be a Fibonacci number if it is a part of the Fn/Fibonacci sequence.

Detailed explanation

```
1 <= T <= 100
0 <= N <= 100000
Where ‘T’ is the number of test cases.
Where 'N' is the given number.
Time limit: 1 sec
```

```
2
5
6
```

```
YES
NO
```

```
In the first test case, 5 is a Fibonacci number.
In the second test case, 6 is not a Fibonacci number.
```

```
2
1
0
```

```
YES
YES
```

```
In the first test case, 1 is a Fibonacci number.
In the second test case, 0 is a Fibonacci number.
```