Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. public class Multiples {
  2. public static void main (String[] args) {
  3. int sum = 0;
  4. for (int i = 0; i < 1000; i++) {
  5. if (i % 3 == 0) {
  6. sum += i;
  7. }
  8. else if (i % 5 == 0) {
  9. sum += i;
  10. }
  11. }
  12. System.out.println(sum);
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement