fork download
  1. #include <stdio.h>
  2.  
  3. int mouse(int n, int a, int b, int c)
  4. {
  5. if (n <=2) return a;
  6. else return mouse(n-1, a*c+1, a, b);
  7. }
  8.  
  9. int main(void)
  10. {
  11. int k;
  12. for (k = 0; k < 10; k++)
  13. printf("mouse(%d) = %d\n", k, mouse(k, 1, 1, 1));
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
mouse(0) = 1
mouse(1) = 1
mouse(2) = 1
mouse(3) = 2
mouse(4) = 3
mouse(5) = 4
mouse(6) = 9
mouse(7) = 28
mouse(8) = 113
mouse(9) = 1018