2 votes 2 votes #include <stdio.h> int gsum(int *a,int n) { if(n<=0) return 0; else { if(*a%2==0) return *a+gsum(a+1,n-1); else return *a-gsum(a+1,n-1); } } int main(void) { // your code goes here int a[]={12,7,13,4,11,6}; printf("%d",gsum(a,6)); return 0; } Programming in C programming-in-c + – gaurav9822 asked Aug 29, 2016 • edited Sep 19, 2016 by go_editor gaurav9822 737 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 5 votes 5 votes It will executed from last . Answer will be 15 12+gsum(a+1,5) 12+3=15 | 7-gsum(a+1,4) =7-4=3 | 13-gsum(a+1,3) =13-9=4 | 4+gsum(a+1,2) =4+5=9 | 11-gsum(a+1,1) =11-6=5 | 6+gsum(a+1,0) =6+0=6 | 0 srestha answered Aug 29, 2016 • selected Sep 19, 2016 by pC srestha comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes 12+(7-(13-(4+(11-(6+0))))) ankit answered Sep 13, 2016 ankit comment Share Follow See all 0 reply Please log in or register to add a comment.