fork download
  1. /* http://t...content-available-to-author-only...h.net/test/read.cgi/tech/1339338438/415 */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. int X(int n)
  7. {
  8. if (n < 1)
  9. return 0;
  10. return 2 * X(n - 1) + 1;
  11. }
  12.  
  13. int main(int argc, char *argv[])
  14. {
  15. int i;
  16. if (argc == 1)
  17. printf("X(0) = %d\n", X(0));
  18. else
  19. for (i = 1; i < argc; i++) {
  20. int n = atoi(argv[i]);
  21. printf("X(%d) = %d\n", n, X(n));
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
X(0) = 0