From 8e77b319b323fa71ea000169df4043e441900026 Mon Sep 17 00:00:00 2001 From: aj Date: Fri, 8 Feb 2019 14:56:20 +0000 Subject: [PATCH] completed multiples of 3 and 5 --- src/multipleof3and5/Multiples.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/multipleof3and5/Multiples.java b/src/multipleof3and5/Multiples.java index 9ea4065..c4cb996 100644 --- a/src/multipleof3and5/Multiples.java +++ b/src/multipleof3and5/Multiples.java @@ -3,8 +3,20 @@ package multipleof3and5; public class Multiples { public static void main(String[] args) { - // TODO Auto-generated method stub - System.out.println("hello world"); + + int upperBound = 1000; + + int total = 0; + + int counter; + for(counter = 0; counter < upperBound; counter++) { + if(counter % 3 == 0 || counter % 5 == 0) { + total += counter; + } + } + + System.out.println("The total of multiples of 3 and 5 below " + upperBound + " is " + total); + } }