كيف اكتب هذا الحل على لغه برنامج الفجول لوجك

include

define DIGITS 10

int main(void)

{

int digit_count[DIGITS] = {0};

int digit, i;

long n;

printf("\nEnter a number: "); scanf("%ld", &n);

/* Count number of times each digit seen */ while (n > 0) { digit = n % 10; // gets the right-most digit. digit_count[digit]++; // add 1 to index matching the right-most digit. n /= 10; // remove the right-most digit from the number. }

/* Print the Digit header */ printf("Digit: "); for (i = 0; i < DIGITS; i++) printf("%3d", i);

/* Print Occurrences */ printf("\nOccurrences:"); for (i = 0; i < DIGITS; i++) printf("%3d", digit_count[i]); printf("\n");

return 0;

}