int countSameDigits(int number) { int count = 0; int digits[10] = {0};
while (number > 0) { int digit = number % 10; digits[digit]++; number /= 10; } for (int i = 0; i < 10; i++) { if (digits[i] > 1) { count++; } } return count;
}
int main() { int array[30]; int count = 0;
srand(time(NULL)); for (int i = 0; i < 30; i++) { array[i] = rand() % 100 + 1; count += countSameDigits(array[i]); } std::cout << "Numbers with same digits in the array: " << count << std::endl; return 0;
int countSameDigits(int number) {
while (number > 0) {int count = 0;
int digits[10] = {0};
int digit = number % 10;
digits[digit]++;
number /= 10;
}
for (int i = 0; i < 10; i++) {
if (digits[i] > 1) {
count++;
}
}
return count;
}
int main() {
srand(time(NULL));int array[30];
int count = 0;
for (int i = 0; i < 30; i++) {
array[i] = rand() % 100 + 1;
count += countSameDigits(array[i]);
}
std::cout << "Numbers with same digits in the array: " << count << std::endl;
return 0;
}