#include < stdio.h >
#include < stdlib.h >
int main() {
int arr[] = {1,2,3,4,5,6,3};
int check;
printf("Enter the number to be checked\n");
scanf("%d", & check);
// loop will run from 0 to (total Elements-2)
for (int i = 0; i < 6; i++) {
// loop will run from i+1 to (total Elements-1)
for (int j = i + 1; j < 7; j++) {
if ((arr[i] + arr[j]) == check) {
printf("[%d,%d],", arr[i], arr[j]);
}
}
}
return 0;
}
Find all pairs of integer array whose sum is equal to a given number.
