retagged by
495 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

retagged by

1 Answer

Related questions

1 votes
1 votes
2 answers
1
Pranav Madhani asked May 26, 2017
1,870 views
int f(int n) { static int i = 1; if (n ≥ 5) return n; n = n + i; i++; return f(n); }The value returned by f(1) is:(a) 5 (b) 6(c) 7 (d) 8 need solution with explaination...
0 votes
0 votes
2 answers
3
Pranav Madhani asked May 25, 2017
8,325 views
Which of the following is not O(n^2)?(a) (15^10) * n + 12099 (b) n^1.98(c) n^3 / (sqrt(n)) (d) (2^20) * n
0 votes
0 votes
2 answers
4
Rustam Ali asked Sep 3, 2018
855 views
Find time complexity of below Program?A(n){if(n<=1) return;elsereturn $A(\sqrt{n})$ ;}