Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int n;
  4. int main()
  5. {
  6. cout<<"Numarul este: ";
  7. int n,x1=0,x2=1,x;
  8. cin>>n;
  9. {
  10. while(n>x2)
  11. {
  12. x=x1+x2;
  13. x2=x1;
  14. x1=x;
  15. }
  16. if(n==x1 || n==x2)
  17. {
  18. cout<<"DA, este fibonacci";
  19. return 0;
  20. }
  21. else
  22. cout<<"NU, nu este fibonacci";
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement