MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / array_sum

Function array_sum

CPP/recursion/recursion2.cpp:11–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10using namespace std;
11int array_sum(int n,int arr[]){
12 if(n<0) return 0;
13 return array_sum(n-1,arr)+arr[n];
14}
15int digit_sum(int n){
16 if(n==0) return 0;
17 return digit_sum(n/10)+ n%10;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected