C Program To Know The Number is in Fibonacci series or not

#include<stdio.h>
#include<conio.h>
void main()
{
int t1,t2,t3,n,temp;
clrscr();
printf("n");
scanf("%d",&n);
temp=n;
t1=0;
t2=1;
t3=0;
while(t3<n)
{
t1=t2;
t2=t3;
t3=t1+t2;
}
if(t3==temp)
printf("YEs");
else
printf("nop");
getch();
}
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.

No comments:

Post a Comment