Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Demo
- {
- public static void main(String[] args) {
- double[] numbers = {1.2, 4.3, 6.5, 3.7, 4.8};
- double total = 0;
- for (double d : numbers) {
- total += d;
- }
- double average = total / numbers.length;
- System.out.println("Average: " + average);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment