hi, i’m trying to find the max sum from the subset sum. But i have only found out the subset sum not the max subset sum from there. I want suppose input array size is n = 5, number of elements to sum is r = 3 And array is : {1,2,3,4,5}

Then maximum sum should be 3 + 4 + 5 = 12 . But it returns all combination sum. This is my code

```
void combinationRecursion(int start, int end, int index, int r, int *arr, int *data, int sum){
if(r == index){
for(int i=0; i<r; i++){
sum = sum + data[i];
}
printf("sum %d\n",sum);
printf("\n");
return;
}
for(int i=start; i<end; i++){
data[index] = arr[i];
combinationRecursion(i+1, end, index+1, r, arr, data, sum);
}
}
int main(){
int arr[100], n, data[100], r;
scanf("%d%d",&n,&r);
for(int i=0; i<n; i++){
scanf("%d",&arr[i]);
}
combinationRecursion(0, n, 0, r, arr, data, 0);
}
```

This is my code . Can somebody tell me what change should i give here to find only the max sum value.