fork download
  1. #include <stdio.h>
  2.  
  3. int func(int x, int y, int z)
  4. {
  5. static int counter = 0;
  6. counter++;
  7.  
  8. if (x == 0 && y == 0 && z == 0)
  9. return counter;
  10.  
  11. int result_x = 1, result_y = 1;
  12. for (int i = 0; i < z; i++) result_x *= x;
  13. for (int i = 0; i < z; i++) result_y *= y;
  14.  
  15. return result_x + result_y;
  16. }
  17.  
  18. int main()
  19. {
  20. int i, x = 0;
  21. for (i = 1; i < 4; i++) x = x + func(i, i, i);
  22. printf("counter=%d\n", func(0, 0, 0));
  23. printf("%d %d\n", x, func(1, 2, 3));
  24. printf("counter=%d\n", func(0, 0, 0));
  25. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
counter=4
64 9
counter=6