Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int variable1 = 1;
  7. int variable2 = 1;
  8. int i = 2;
  9. int fin = 0;
  10. printf("Quelle occurence recherchez vous ?");
  11. scanf("%d", &fin);
  12. while(i<fin)
  13. {
  14. variable1 = variable1 + variable2;
  15. i++;
  16. variable2 = variable1 + variable2;
  17. i++;
  18. }
  19. if(fin%2==0)
  20. {
  21. printf("La %d eme occurence est : %d", fin, variable2);
  22. }
  23. else
  24. {
  25. printf("La %d eme occurence est : %d", fin, variable1);
  26. }
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement