# Program to verify if a given number belongs to Fibonacci sequence or not:
n=input("Enter a number to check if it belongs to Fibonacci series or not:")
a=1
b=1
c=0
c=a+b
n=int(n)
while c<=n:
a=b
b=c
c=a+b
if b==n:
print("Entered number belongs to Fibonacci series.")
else:
print("Entered number does not belong to Fibonacci series.")
n=input("Enter a number to check if it belongs to Fibonacci series or not:")
a=1
b=1
c=0
c=a+b
n=int(n)
while c<=n:
a=b
b=c
c=a+b
if b==n:
print("Entered number belongs to Fibonacci series.")
else:
print("Entered number does not belong to Fibonacci series.")
Comments
Post a Comment