/* * Find the multiple of 2 number that are under 1000 * * The Question is: * If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. * The sum of these multiples is 23. * Find the sum of all the multiples of 3 or 5 below 1000. * */

So i went ahead and realized that for this i would need a for loop, i also figured i needed an if statement but never implemented it because i wasn't sure how to use it in this scenario.

So as for me, i created this which by the way i got all the multiples of 3 the way i wanted but i feel like i cheated myself. Instead of using computing logic and use statements, methods, or loops to find the multiples of 3, i just simply kept adding 3 resulting in the correct answer. Could anyone show me how it was suppose to be programmed or was this the actual way i should of done it ? Thanks

public class multiples { public static void main(String[] args) { multipleOf3(); } public static void multipleOf3(){ int multipleOf3 = 3; for(int i = 0; i < 1000; i+=3){ System.out.println(i); } } }

REMEMBER IM ONLY SOLVING FOR THE MULTIPLE OF 3 NOT 5

Thank You

-Jonathan