โ Back to Arrays
Question 169
Sum With foreach
Sum With foreach
An int array is given. Use a foreach loop to add up its elements and print the total.
For { 5, 10, 15 } the program prints 30.Expected Output:
30
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.