fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a[50],i,sum;
  5. a[0]=2;
  6. a[1]=-1;
  7.  
  8. for(i=2,sum=0;i<=30;i++){
  9. a[i]=-a[i-1]+a[i-2]+2;
  10. if(i%4==0)
  11. sum = sum + a[i];
  12. }
  13.  
  14. printf("%d",sum);
  15. return 0;
  16. }
  17.  
  18.  
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
1116311