Răspuns:
//Ai aici tot programul
#include <iostream>
using namespace std;
unsigned suma(unsigned n, unsigned v[])
{
unsigned i;
unsigned long long s=0;
for(i=0;i<n;i++)
s+=v[i];
return s;
}
int main()
{
unsigned n,i;
cin>>n;
unsigned v[n];
for(i=0;i<n;i++)
cin>>v[i];
cout<<suma(n,v);
return 0;
}
Explicație:
//doar functia
unsigned suma(unsigned n, unsigned v[])
{
unsigned i;
unsigned long long s=0;
for(i=0;i<n;i++)
s+=v[i];
return s;
}