diff --git a/Java/Average.java b/Java/Average.java index 41776cbf..09c4811b 100644 --- a/Java/Average.java +++ b/Java/Average.java @@ -1,13 +1,13 @@ public class Average { public static void main(String[] args) { double[] numArray = { 45.4, 67.6, -45.4, 20.33, 33.1, 45.4 }; - double sum = 0.0; + double count = 0.0; for (double num: numArray) { - sum += num; + count += num; } - double average = sum / numArray.length; + double average = count / numArray.length; System.out.format("The average is: %.2f", average); } }