โ Back to Functions/Methods
Question 291
Function: Sum of Array
Function: Sum of Array
Write a functionsumArray(int arr[], int n)that returns the sum of the firstnelements ofarr. 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.