CJCoding With Joseph

Function: Sum of Array

Write a function sumArray(int arr[], int n) that returns the sum of the first n elements of arr. Use it on the array {3, 1, 4, 1, 5, 9, 2, 6} and print the total:

31

Print with %d.

Expected Output:

31
Topics:
Functions/Methods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.