Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Welcome to GDB Online.
- GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
- Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
- Code, Compile, Run and Debug online from anywhere in world.
- *******************************************************************************/
- #include <stdio.h>
- #include <math.h>
- int fibonachi(int n[],int i)
- { int x,y;
- x=sqrt(5*n[i]*n[i]-4);
- y=sqrt(5*n[i]*n[i]+4);
- if(x*x==5*n[i]*n[i]-4||y*y==5*n[i]*n[i]+4&&n[i]%2==0)return 1;
- return 0;
- }
- int main()
- { int i;
- int n[]={1,2,3,4,5,6,7,8};
- for(i=0;i<8;i++)
- {
- if(fibonachi(n,i)==1)printf("%d\n",n[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement