fork download
  1. #include <stdio.h>
  2.  
  3. int c;
  4.  
  5. int rec(int n){
  6. c++;
  7.  
  8. if(n==1){
  9. return 1;
  10. }else if(n==2){
  11. return 2;
  12. }else{
  13. return -6*rec(n-1)-9*rec(n-2);
  14.  
  15. }
  16. }
  17.  
  18. int main(void) {
  19. int n = 5;
  20. printf("a%d is %d\n",n,rec(n));
  21. printf("%d is count",c);
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
a5 is -459
9 is count