Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int n;
- int main()
- {
- cout<<"Numarul este: ";
- int n,x1=0,x2=1,x;
- cin>>n;
- {
- while(n>x2)
- {
- x=x1+x2;
- x2=x1;
- x1=x;
- }
- if(n==x1 || n==x2)
- {
- cout<<"DA, este fibonacci";
- return 0;
- }
- else
- cout<<"NU, nu este fibonacci";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement