Skip to content

Instantly share code, notes, and snippets.

@KristianLyng
Created March 17, 2010 16:16
Show Gist options
  • Save KristianLyng/335408 to your computer and use it in GitHub Desktop.
Save KristianLyng/335408 to your computer and use it in GitHub Desktop.
int sumToN (int n) {
if (n == 0)
return 0;
else
return n + sumToN(n-1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment