Hi, I know this is going to be SO simple when its pointed out but I've been working on this for the past 3 hours and I just can't understand it. I am VERY new to Java and I am trying to solve the 1st problem from project Euler. The problem is: To add all the natural numbers below 1000 that are divisable by 3 or 5. The following code determins whether the number is divisible by 3 and adds i to the total each time it finds a one. This part of the code works perfectly and I get the expected outcome. I can also change the value to 5 and that works accordingly.
So give that this works perfectly I figured I would just be able to add an OR operator to determine whether i is divisible by 3 OR 5:
However for some reason this simply returns the value 49500. Witch is wrong. I have tried replacing 1000 with 10 which should give me a value of 23 but I get 0. Any pointers would be hugely appreciated.
Thanks