Created
October 23, 2017 17:30
-
-
Save PocasPedro/6d165423319adf4e86d456f5df485257 to your computer and use it in GitHub Desktop.
Java Fundamentals for Kids - Exercise 16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MeanArray { | |
public static void main(String[] args) { | |
//Define & Initialization | |
int numbers[] = new int[] {196,10,6,40,44}; | |
int sum = 0; | |
for(int i = 0 ; i <= 4 ; i ++){ | |
sum += numbers[i]; | |
} | |
double mean = Mean(sum, numbers.length); | |
System.out.println("The mean of the numbers array is: " + mean); | |
} | |
public static double Mean(int sumofall, int total){ | |
double mean = sumofall / total ; | |
return mean; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment