I have written this program to detect whether two numbers are consecutive terms of the fibonacci series. The code that I have written below gives me wrong answer when I enter 21 and 34 and 55 and 89 (gives right answer for other entries). Below is the fibonacci series representation:
1 1 2 3 5 8 13 21 34 55 89...
A fibonacci series is made up of consecutively adding two previous terms. Below is my code;
Thank you for your help.
printf("enter the numbers >1 to be checked");
while(a!=1 && (b!=1||0))
if(a==1 && (b==1||0))
printf("the given numbers were fibonacci series numbers");
printf("the given numbers were not fibonacci numbers");