Skip to content

Instantly share code, notes, and snippets.

@yuchan
Created November 21, 2012 14:57
Show Gist options
  • Save yuchan/4125245 to your computer and use it in GitHub Desktop.
Save yuchan/4125245 to your computer and use it in GitHub Desktop.
project euler problem #1
#include <iostream>
using namespace std;
int main()
{
int sum = 0;
for(int i = 1; i < 1000; i++){
if(i % 3 == 0 ||
i % 5 == 0)
sum += i;
else
continue;
}
cout << "sum=" << sum << endl;
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment