Skip to content

Commit 9d56e41

Browse files
Update Coding_Challenges.java
1 parent 4a9b50d commit 9d56e41

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Coding_Challenges.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,18 @@ public static void main(String[] args) {
105105

106106
// 5. Finding the Average of Numbers:
107107

108+
public class Main {
109+
public static void main(String[] args) {
110+
int[] numbers = {10, 20, 30, 40, 50};
111+
int size = numbers.length;
112+
int sum = 0;
113+
114+
for (int i = 0; i < size; i++) {
115+
sum += numbers[i];
116+
}
117+
118+
float average = (float)sum / size;
119+
System.out.print("Average: " + average);
120+
return;
121+
}
122+
}

0 commit comments

Comments
 (0)