compute the average of an array c++

#include <iostream>

int main() {
    const int size = 5; // Set the size of the array
    int arr[size]; // Declare an array of integers
    double sum = 0.0; // Initialize a variable to store the sum of array elements

    // Input values into the array
    std::cout << "Enter " << size << " integers:\n";
    for (int i = 0; i < size; ++i) {
        std::cout << "Element " << i + 1 << ": ";
        std::cin >> arr[i];
        sum += arr[i]; // Add each element to the sum
    }

    // Calculate the average
    double average = sum / size;

    // Display the average
    std::cout << "Average: " << average << std::endl;

    return 0;
}