//phytogorus triplet int hasArrayThreeCandidates(int A[], int size) { for(int i=0;i<size;i++) { if (hasArrayTwoCandidates(A,6,A[i])) { cout<<" ," << A[i]; return 1; } } return 0; }
/* Driver program to test above function */ int main() { int A[] = {1, 4, 45, 6, 10, -8}; int n = 16; int arr_size = 6; if( hasArrayTwoCandidates(A, arr_size, n)) printf("Array has two elements with sum 16"); else printf("Array doesn't have two elements with sum 16 "); getchar(); return 0; }