Fibonacci Number Verification

Identify if the provided integer 'N' is a Fibonacci number.

A number is termed as a Fibonacci number if it appears in the Fibonacci sequence, where each number is the sum of the two preceding ones, with the sequence beginning from 0 and 1. The sequence can be described as:

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

Input:

The first input line contains a single integer ‘T’, representing the number of test cases.
Each test case has one integer 'N' in a new line, the number to assess if it is a Fibonacci number.

Output:

For each test case, output “YES” if the number is a Fibonacci number; otherwise, output “NO”.
Each result should be printed on a separate line.

Example:

Input:
3
2
4
8
Output:
YES
NO
YES

Constraints:

  • 1 ≤ T ≤ 100
  • 0 ≤ N ≤ 100000

Note: Implementation should not include printing; it is handled externally.

AnswerBot
4mo

Check if a given number is a Fibonacci number or not.

  • Iterate through the Fibonacci sequence until you find a number greater than or equal to the given number.

  • Check if the given number matches the Fibo...read more

Help your peers!
Select
Add answer anonymously...

Twitter Software Developer interview questions & answers

A Software Developer was asked 6mo agoQ. Explain the process of calling an API.
A Software Developer was asked Q. Break The Board Problem Statement Your task is to break a board of given dimensi...read more
A Software Developer was asked Q. Fibonacci Number Verification Identify if the provided integer 'N' is a Fibonacc...read more

Popular interview questions of Software Developer

A Software Developer was asked Q1. Break The Board Problem Statement Your task is to break a board of given dimensi...read more
A Software Developer was asked Q2. Fibonacci Number Verification Identify if the provided integer 'N' is a Fibonacc...read more
A Software Developer was asked Q3. Design a Facebook-like application.
Twitter Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits