Untitled
public class Average { public static void main(String[] args) { int arr[] = { 1, 2, 3, 4, 5, 6, 1, 10 }; int average = 0; int remainder = 0; int len = arr.length; for (int i = 0; i < len; i++) { int q = arr[i] / len; int r = arr[i] % len; average = average + q; remainder += r; } if (remainder >= len) { average = average + remainder / len; } System.out.println(average); } }