Lets write a C program to count the number of occurrences of digit k in user input positive integer number…