0

Write a program in c++ to find the sum of array

Please help fast i have school in 1 hour!!

13th Dec 2016, 12:56 AM
Akshit Kanaujia
Akshit Kanaujia - avatar
2 Respostas
+ 3
//int size = the size of your array. //myArray is your array's name. int sum = 0; for(int x = 0; x < size; x++) sum += myArray[x];
13th Dec 2016, 1:45 AM
Jafca
Jafca - avatar
+ 1
int sum=0; for(int i=0; i<array.size(); i++){ .sum+=array[i]; } cout<<sum;
13th Dec 2016, 6:47 AM
Sandeep Chatterjee