Created
March 6, 2016 23:53
-
-
Save oldhill/500c759d35120d3023ac to your computer and use it in GitHub Desktop.
euler in c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n = 100000000; | |
printf("\nFinding sum of multiples of 3 and 5 below %d\n", n); | |
long total = 0; | |
for (int i = 0; i < n; ++i) { | |
if (i % 3 == 0) { | |
total = total + i; | |
} | |
else if (i % 5 == 0) { | |
total = total + i; | |
} | |
} | |
printf("Result: %ld\n", total); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment