Created
October 25, 2015 05:04
-
-
Save giraffesyo/009dbc9d3ea17b854da4 to your computer and use it in GitHub Desktop.
Multiples of 3 and 5
This file contains hidden or 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 <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