Fibonacci数列.c 161 B

12345678910111213141516
  1. #include <stdio.h>
  2. int main() {
  3. int n;
  4. scanf("%d",&n);
  5. int i,x,y=0,z=1;
  6. for(i=1;i<=n;i++) {
  7. x = y;
  8. y = z;
  9. z += x;
  10. }
  11. printf("%d",y);
  12. return 0;
  13. }