diff --git a/src/com/.DS_Store b/src/com/.DS_Store index e3f6b96..e716a71 100644 Binary files a/src/com/.DS_Store and b/src/com/.DS_Store differ diff --git a/src/com/array/rotations/ArrayAverage.java b/src/com/array/rotations/ArrayAverage.java new file mode 100644 index 0000000..fd362c5 --- /dev/null +++ b/src/com/array/rotations/ArrayAverage.java @@ -0,0 +1,29 @@ +package com.array.rotations; + +public class ArrayAverage { + + public static void main(String[] args) { + int n = 10; + int[] arr = new int[n]; + + // Input array elements + System.out.println("Enter the elements of the array: "); + for (int i = 0; i < n; i++) { + arr[i] = 1+i; + } + + // Calculate sum of elements + int sum = 0; + for (int i = 0; i < n; i++) { + sum += arr[i]; + } + + // Calculate average + double average = (double) sum / n; + + // Output the average + System.out.println("The average is: " + average); + + } + +}