sum values of array code example
Example 1: sum of an array
const sum = (...args) => args.reduce((a, b) => a + b, 0);
console.log(sum(1,2,3)); // returns 6
Example 2: how to find sum of array
//C++
int arr[5]={1,2,3,4,5};
int sum=0;
for(int i=0; i<5; i++){sum+=arr[i];}
cout<