public static int countDigits(int n, int item){
int cnt = 0;
while(n != 0){
int rem = n % 10;
if(rem == item) cnt++;
n = n/10;
}
return cnt;
}
//sir suppose in this solution if user enter n=0 and item=0
then the count should be 1 isnt it?? as we are counting the number of item in n