#include<stdio.h>
int recursion(int* array,int i,int j,int size){
int sum = 0;
if(i < size-1){
if(j < size ){
printf("+(%d+%d)",array
[i
], array
[j
]); sum = sum+array[i]+array[j];
j++;
sum = sum + recursion(array,i,j,size);
}
else{
i++;
j=i+1;
sum = sum + recursion(array,i,j,size);
}
}
return sum;
}
int main(){
int i=0,j=i+1,sum=0;
int a[3]={2,4,6};
int c =recursion(a,i,j,3);
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KICAgICBpbnQgcmVjdXJzaW9uKGludCogYXJyYXksaW50IGksaW50IGosaW50IHNpemUpewogICAgIAlpbnQgc3VtID0gMDsKICAgICAgICAgICAgaWYoaSA8IHNpemUtMSl7CiAgICAgICAgICAgICAgICAgICBpZihqIDwgc2l6ZSApewogICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoIisoJWQrJWQpIixhcnJheVtpXSwgYXJyYXlbal0pOwogICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSBzdW0rYXJyYXlbaV0rYXJyYXlbal07CiAgICAgICAgICAgICAgICAgICAgICAgIGorKzsKICAgICAgICAgICAgICAgICAgICAgICAgc3VtID0gc3VtICsgcmVjdXJzaW9uKGFycmF5LGksaixzaXplKTsKICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgIGVsc2V7CiAgICAgICAgICAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgICAgICAgICAgICAgICBqPWkrMTsKICAgICAgICAgICAgICAgICAgICAgICAgIHN1bSA9IHN1bSArIHJlY3Vyc2lvbihhcnJheSxpLGosc2l6ZSk7CiAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gICAgICAgCiAgICAgICAgICAgIHJldHVybiBzdW07CiAgICAgfQoKICAgIGludCBtYWluKCl7CiAgICAgICBpbnQgaT0wLGo9aSsxLHN1bT0wOwogICAgICAgaW50IGFbM109ezIsNCw2fTsKICAgICAgCiAgICAgICBpbnQgYyA9cmVjdXJzaW9uKGEsaSxqLDMpOwogICAgICAgcHJpbnRmKCI9JWQiLGMpOwogICAgICAgcmV0dXJuIDA7CiAgICB9