We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 20d2074 + c9504e3 commit ad08916Copy full SHA for ad08916
src/com/.DS_Store
0 Bytes
src/com/array/rotations/ArrayAverage.java
@@ -0,0 +1,29 @@
1
+package com.array.rotations;
2
+
3
+public class ArrayAverage {
4
5
+ public static void main(String[] args) {
6
+ int n = 10;
7
+ int[] arr = new int[n];
8
9
+ // Input array elements
10
+ System.out.println("Enter the elements of the array: ");
11
+ for (int i = 0; i < n; i++) {
12
+ arr[i] = 1+i;
13
+ }
14
15
+ // Calculate sum of elements
16
+ int sum = 0;
17
18
+ sum += arr[i];
19
20
21
+ // Calculate average
22
+ double average = (double) sum / n;
23
24
+ // Output the average
25
+ System.out.println("The average is: " + average);
26
27
28
29
+}
0 commit comments