Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBaneTrapper

Posted 28 November 2012 - 12:52 PM

You're accumulating multiples of 15 twice since those numbers are divisible by both 3 and 5. I'm not going to provide a solution though, but let you think about it.

You don't have to, and thanks for the answer.
I feel oddly stupid.

The output now is now correct
Combined the if statement to one
if((i % 3) == 0 || (i%5) == 0)
        {
            sum += i;
            OStream << i << "\n";
        }

#1BaneTrapper

Posted 28 November 2012 - 12:51 PM

You're accumulating multiples of 15 twice since those numbers are divisible by both 3 and 5. I'm not going to provide a solution though, but let you think about it.

You don't have to, and thanks for the answer.
I feel oddly stupid.

PARTNERS