Skip to content

Instantly share code, notes, and snippets.

@zohaad
Created August 27, 2016 15:19
Show Gist options
  • Save zohaad/2f4cf8ed67bafa196a738a70d6cf8ffd to your computer and use it in GitHub Desktop.
Save zohaad/2f4cf8ed67bafa196a738a70d6cf8ffd to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
int sum = 0;
for (int i = 0; i <= 1000; ++i) {
if (!(i % 3) || !(i % 5)) {
sum += i;
}
}
cout << sum << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment