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 = 0; i < argc; i++) {
  20. printf("X(%d) = %d\n", i, X(atoi(argv[i])));
  21. }
  22. return 0;
  23. }
  24.  
  25.  
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
X(0) = 0