i tink logic which kamakshi gave is correct


code for same:::


#include<stdio.h>

int max(int a,int b)
{
    return (a>b?a:b);
}

int value(int a[],int l)
{
    if(l<0)
        return 0;
    return max(a[l]+value(a,l-2),value(a,l-1));
}

int main()
{
    int a[]={4,3,2,5,7,8};
    printf("max::%d",value(a,5));
    return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to