I'm trying to eliminate some number from range (170-2500) and then calculate the remaining numbers after the elimination. The numbers composed of 3 digits from number's list (2,5,6,7). I have tried using Cartesian Product
to generate the numbers, but I confused how to eliminate the numbers from the range. The cartesian product code is obtained from geeksforgeeks. I know how to calculate the remaining numbers but I confused with the numbers that will be eliminated.
void findCart(int arr1[], int n)
{
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
for (int k = 0; k < n; k++)
printf("{%d%d%d}, ", arr1[i], arr1[j], arr1[k]);
}
int main()
{
min=170;
max=2500;
int arr1[] = {2,5,6,7};
int n1 = sizeof(arr1) / sizeof(arr1[0]);
findCart(arr1, n1, number);
int count=0;
if (number>=min && number<=max){
count++;
}
int total=max-min+1;
int result=total-count;
cout<<result;
return 0;
}