fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a[100],n,i;
  5. scanf("%d",&n);
  6. printf("n=%d\n",n);
  7. a[0]=0;
  8. a[1]=1;
  9. printf("%d %d",a[0],a[1]);
  10. for(i=2;i<n;i++){
  11. a[i]=a[i-2]+a[i-1];
  12. printf("%2d",a[i]);
  13. }
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5280KB
stdin
5
stdout
n=5
0 1 1 2 3