#include <stdio.
h>
int main() {
int num, digit;
int frequency[10] = {0}; // Array to store the frequency of digits (0-9)
// Input a number
printf("Enter a number: ");
scanf("%d", &num);
// Make a copy of the number to avoid changing the original input
int temp = num;
// Calculate frequency of each digit
while (temp > 0) {
digit = temp % 10; // Get the last digit
frequency[digit]++; // Increment the frequency of the digit
temp /= 10; // Remove the last digit
}
// Display the frequency of each digit
printf("Frequency of each digit in %d:\n", num);
for (int i = 0; i < 10; i++) {
if (frequency[i] > 0) {
printf("Digit %d: %d times\n", i, frequency[i]);
}
}
for (int i = 0; i < 10; i++) {
printf("%d",frequency[i]);
}
}