#include<iostream>
using namespace std;
int main ()
{
    int arr[14], n, i, sum = 0;
    cout << "Enter the size of the array : ";
    cin >> n;
    cout << "\nEnter the elements of the array : ";
    for (i = 0; i < n; i++)
    cin >> arr[i];
    for (i = 0; i < n; i++)
    {
        sum += arr[i];

    }
    cout << "\nSum of array elements : " << sum;

    return 0;
}

It’s hard for anyone to help you because you’re not really describing what your problem is. Is the code you provided not working? Are you getting any error messages? Your topic title says to write an algorithm and then you just posted a bunch of code. We are confused how we can help.