#include <iostream>
#include <array>
#include <numeric> // std::accumulate
int main() {
std::array<int, 5> arr = {1, 2, 3, 4, 5};
// Multiply all elements using std::accumulate
int product = std::accumulate(arr.begin(), arr.end(), 1, std::multiplies<int>());
std::cout << "The product of all elements is: " << product << std::endl;
}
/*
run:
The product of all elements is: 120
*/