← Back to Pointers
Question 434
Sum Five Scores Through a Pointer
Sum Five Scores Through a Pointer
Read 5 whole numbers from input into the array scores (that loop is already written for you). A pointer p already points at scores[0].
In the second loop, add the value at *(p + i) into total. Then the program prints the total on one line.
For the input:
10 20 30 40 50
The output for that input is shown in Expected Output.Expected Output:
Total: 150= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Pointers
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.