fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. int n=30;
  6. int a[n];
  7. int i;
  8. a[0]=2;
  9. a[1]=-1;
  10.  
  11. for(i=2;i<n;i++){
  12. a[i]=-a[i-1]+a[i-2]+2;
  13. }
  14.  
  15. printf("a[29]=%d\n",a[29]);
  16.  
  17. // your code goes here
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
a[29]=-1542685