Guest User

Untitled

a guest
Dec 14th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. int lucas(int x){
  2.  
  3. int luca[50] = {2,1};
  4. int i;
  5.  
  6. if (x == 0) return 2;
  7. if (x == 1) return 1;
  8.  
  9. for(i=0;i<=x;i++){
  10. luca[i] = luca[i-1] + luca[i-2];
  11. }
  12.  
  13. return luca[x];
  14. }
Add Comment
Please, Sign In to add comment