| 1 | #include<iostream> |
| 2 | using namespace std; |
| 3 | bool exp(int arr[],int n,int target,int count=0) |
| 4 | { |
| 5 | ; |
| 6 | if(count==3&&target==0) |
| 7 | return true; |
| 8 | if(count==3||n==0||target<0) |
| 9 | return false; |
| 10 | return exp(arr, n - 1, target - arr[n - 1], count + 1) || |
| 11 | exp(arr, n - 1, target, count); |
| 12 | } |
| 13 | int main(){ |
| 14 | int arr[]={ 2, 7, 4, 0, 9, 5, 1, 3 }; |
| 15 | int target = 6; |