fork download
  1. #include <stdio.h>
  2. int main(void) {
  3. int a[30];
  4. int n=0;
  5. a[0]=2;
  6. a[1]=-1;
  7. while(a[n]<=5000){
  8. a[n+2]=-a[n+1]+a[n]+2;
  9. n++;
  10. }
  11. printf("%d",n);
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
18