#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;
}

Recommended Answers

All 3 Replies

Please, I need help urgently

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.