Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // More Code Tutorials from Brandonhok.com
- // Summing all elements of an array
- #include <iostream>
- using namespace std;
- int main()
- {
- const int arraySize = 10;
- int a[arraySize] = { 87,11,22,55,33,66,11,42,80,11 };
- int total = 0;
- for (int i = 0; i < arraySize; ++i)
- total += a[i];
- cout << "Total of array elements: " << total << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement