fork download
  1. class Problem
  2. {
  3. // Variable set up:
  4. static int numbers;
  5.  
  6. static int belowThis = 1000; // Check all numbers below this number
  7.  
  8.  
  9. public static void main(String[] args){
  10. System.out.println( multiples(belowThis));
  11.  
  12.  
  13. }
  14.  
  15. // Change this method name please
  16. public static int multiples(int num){
  17.  
  18. for(int i = 1; i < num; i++){
  19.  
  20. if (i % 3 == 0 || i % 5 == 0)
  21. {
  22. numbers += i;
  23. }
  24. }
  25. return numbers;
  26. }
  27. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
233168