fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int fib[100];
  5. int n;
  6. scanf("%d", &n);
  7. fib[0] = 0;
  8. fib[1] = 1;
  9. n--;
  10. for (int i = 2; i < n; i++) fib[i] = fib[i - 1] + fib[i - 2];
  11. for (int i = 0; i < n; i++) printf("%d ", fib[i]);
  12. }
  13.  
  14. //https://pt.stackoverflow.com/q/244268/101
Success #stdin #stdout 0s 4340KB
stdin
10
stdout
0 1 1 2 3 5 8 13 21