Skip to content

Commit cb392d9

Browse files
committed
made some updates
1 parent 9909b5a commit cb392d9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Arrays/finding_max_and_min.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class min_max{
1414
int[] scores = {84, 92, 76, 90, 88, 95, 73, 89};
1515
int max =0;
1616
int min = Integer.MAX_VALUE;
17+
int sum =0;
1718

1819
void max_min() {
1920
for (int i = 0; i < scores.length; i++) {
@@ -24,7 +25,12 @@ void max_min() {
2425
min = scores[i];
2526
}
2627
}
28+
for(int j: scores){
29+
sum += j;
30+
}
31+
double avg = (sum/(scores.length));
2732
System.out.println("The maximum number is: " + max);
2833
System.out.println("The minimum number is: " + min);
34+
System.out.println("The average number is: " + avg);
2935
}
3036
}

0 commit comments

Comments
 (0)