Skip to content

Instantly share code, notes, and snippets.

@hogelog
Created March 17, 2009 09:50
Show Gist options
  • Save hogelog/80434 to your computer and use it in GitHub Desktop.
Save hogelog/80434 to your computer and use it in GitHub Desktop.
int sum_for() {
int x, result = 0;
for (x=0;x<1000;++x) {
result += x;
}
return result;
}
int sum_while() {
int x, result = 0;
x = 0;
while (x<1000) {
result += x;
++x;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment