Created
September 21, 2017 21:34
-
-
Save matinkaboli/122ea2d4a8236be1acf302a7c901df2f to your computer and use it in GitHub Desktop.
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 checkNumbers(int n) { | |
if (n % 3 == 0 || n % 5 == 0) { | |
return 1; | |
} | |
return 0; | |
} | |
int main() { | |
long sum = 0; | |
for (int i = 0; i < 1000000; i++) { | |
if (checkNumbers(i)) sum += i; | |
} | |
printf("%ld\n", sum); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment