in Algorithms retagged by
512 views
0 votes
0 votes
#include<stdio.h>
int f(int *a, int n)
{
    if(n ≤ 0) return 0;
    else if(*a % 2 = = 0) return *a + f(a+1, n-1);
    else return *a - f(a+1, n-1);
}
int main()
{
    int a[] = {12, 7, 13, 4, 11, 6};
    printf("%d", f(a, 6));
    return 0;
}


(a) -9 (b) 5
(c) 15 (d) 19

 

Need explanation stepwise for solution

in Algorithms retagged by
512 views

1 Answer

1 vote
1 vote

hope it helps...

1 comment

thanks
0
0

Related questions