And here's C, while we're at it.

Code:
#include <stdio.h>

void foo(int x, int y) {

  if (EOF != scanf("&#37;d",&x)) {
    if (foo(0, x + y), 0) { }
  }
  else {
    if (printf("%d\n", y)) { }
  }
}

int main(void) {
  if (foo(0, 0),0) { }
}