No output in my code???
So I was writing a code to calculate the sum of all the multiples of 3 and 5 below 1000, but when I finished it and run it, the program didn't have any output. I revised the code for mistakes but I didn't find anything, so maybe someone could tell me why there's no output? Here's the code: #include <iostream> using namespace std; int main() { int multiple5 = 5; int multiple3 = 3; int result = 0; while (multiple3 < 1000) { // I use this if so the multiple5 int doesn't sum to the result after reaching 1000. if (multiple5 >= 1000) { result += multiple3; multiple3 += 3; } //Here is the code that is executed when both multiples are below 1000. else { // I use this if because sometimes the multiple may be the same, and I don't want it to be sumed twice. if (multiple3 != multiple5) { result += multiple3 + multiple5; } else { result += multiple3; multiple3 += 3; multiple5 += 5; } } } cout << result; }