Whats wrong in this code?

Whats wrong in this code

include <bits/stdc++.h>
using namespace std;
For c++ function that returns the number of times digit is found in the number problem. It’s not passing the test cases.

int main()
{
long long int n;

int d;
cin >> n;
cin >> d;
if (d>=0 && d<=9)
{
	int c = 0; 
    while (n > 0) { 
       
        if (n % 10 == d) 
            c++;  
        n = n / 10; 
}
return c;
} 

}

Hey @Shieldx10
Here instead of retuning c

cout<<c;
return 0;