Skip to content

Instantly share code, notes, and snippets.

@giraffesyo
Created October 25, 2015 05:04
Show Gist options
  • Save giraffesyo/009dbc9d3ea17b854da4 to your computer and use it in GitHub Desktop.
Save giraffesyo/009dbc9d3ea17b854da4 to your computer and use it in GitHub Desktop.
Multiples of 3 and 5
#include <iostream>
using namespace std;
int main()
{
int iteration = 1;
int sum = 0;
while (iteration < 1000)
{
if (iteration % 3 == 0 || iteration % 5 == 0)
sum += iteration;
iteration++;
}
cout << sum;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment