Skip to content

Instantly share code, notes, and snippets.

@javascripter
Created March 24, 2010 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javascripter/342302 to your computer and use it in GitHub Desktop.
Save javascripter/342302 to your computer and use it in GitHub Desktop.
#include <stdio.h>
/* Project Euler - Problem 1 */
int prob() {
int i;
int total = 0;
for (i = 1; i < 1000; i++) {
if (i % 3 == 0 ||
i % 5 == 0) {
total += i;
}
}
return total;
}
int main(int argc, char *argv[]) {
int result = prob();
printf("%d\n", result);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment