#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;
}
Dee_2_dee
0
Newbie Poster
Recommended Answers
Jump to PostIt’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 …
All 3 Replies
Dee_2_dee
0
Newbie Poster
Dani
4,084
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
rproffitt
2,580
"Nothing to see here."
Moderator
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.