While Loop: Sum an Array
easyQuestion 27Use a while loop to find the total of all numbers in the array.
Array: [4, 8, 2, 6]
Steps: 1. Use the provided numbers array 2. Create index and total variables 3. Use a while loop to add each number to total 4. Print the total
Expected output
Total: 20= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
LoopsArrays
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.