  // Calculates factorials between 0 and n

  n = 20;

  for (i=0; i<=n; i++)
      print(i + "  " + factorial(i));

  function factorial(x) {
      if (x <= 1)
          return 1;
      else
          return x * factorial(x-1);
  }
