package jp.co.jid.etc;

public class Exercise02 {

	public static void main(String[] args) {
		int array[] = create(5);
		for (int num : array) {
			System.out.println(num);
		}
		System.out.println("---------------------");
		System.out.println("平均値は" + getAvg(array));
	}

	private static int[] create(int count) {
		int array[] = new int[count];
		for (int i = 0; i < count; i++) {
			array[i] = (int) (Math.random() * 100) + 1;
		}
		return array;
	}

	private static double getAvg(int array[]) {
		int sum = 0;
		for (int num : array) {
			sum += num;
		}
		return sum / array.length;
	}
}
