C++ program for finding the maximum product of sub array of a given array
Algorithm: 1. Initialize a variable `result` and set it equal to the first element of the array, i.e., `arr[0]`. ``` result = arr[0] ``` 2. Run a loop from `i = 0` to `n-1`, where `n` is the size of the array. ``` for i = 0 to n-1 ``` 3. Inside the outer loop, create a variable `mul` and set it equal to the current element `arr[i]`. ``` mul = arr[i] ``` 4. Run an inner loop from `j = i+1` to `n-1`. ``` for j = i+1 to n-1 ``` 5. Inside the inner loop, update `mul` by multiplying it with the current element `arr[j]`. ``` mul *= arr[j] ``` 6. Update the `result` to be the maximum of the current `result` and `mul`. ``` result = max(result, mul) ``` 7. Outside both loops, return the final value of `result` as it contains the maximum product of a subarray. ...