So I'm pretty new to C++, and I'm in need of a little help trying to understand the way my code is being interpreted. I'm not completely clueless, as I've read a few texts at decent length; but my problem is that i've got very little experience in application. I've successfully programmed simple things like a program to change pennies into dollars, quarters, nickels, and dimes.
Anyhow, I read about this Project Euler thing and I thought it was a perfect chance for me to get some practice. But I've failed on the very first problem many times already, and i've approached the problem in many ways, yet nothing i do seems to work. Anyone else fluent in C++ that can point out where I've screwed up?
The problem asks for the sum of all the multiples of 3 and 5 that are less than 1000. The following is my code.
do{
checking++;
    if( (checking % 3) == 0 || (checking % 5) == 0 );
         {
              sum = sum + checking;
         };
   }while(checking < 999);
---edit---
Glitchspot is not agreeing with me today :(
Log in to comment