C Program To Count Digit k in Number n
Satish B
https://technotip.com/8187/c-program-to-count-digit-k-in-number-n/
Lets write a C program to count the number of occurrences of digit k in user input positive integer number n, using iterative logic. We will be using while loop to iterate in this program.
For Example: If user inputs n = 1550, and k = 5, then our C program should find how many times digit 5 is present in number 1550.
Note: (num % 10) fetches last digit in num. If num = 1234; (num%10) fetches the last digit from right, which is 4.
(num/10) removes the last number from right. If num = 1234; (num/10) removes last digit i.e., 4 and the result of (num/10) will be 123.
C Programming Interview / Viva Q&A List https://technotip.com/6378/c-programming-interview-viva-qa-list/
C Programming: Beginner To Advance To Expert https://technotip.com/6086/c-programming-beginner-to-advance-to-expert/ ... https://www.youtube.com/watch?v=zsHoXuew33A
11670499 Bytes