[Solved] Need a code that counts the same digit in a number
You could use a function like this, where n is the number and d is the digit you want to count: int count_dig(int n, int d) { int result = 0; while (n > 0) { if (n % 10 == d) { result++; } n/=10; } return result; } Using this, you could print … Read more