public class CountZeros {
public static int countZeros(int n) {
if(n==0) {
return 1;
}
else {
return countZero(n);
}
}
public static int countZero(int n) {
if(n<10) {
if(n==0)
{
return 1;}
else {
return 0;
}
}
else {
int temp = n%10;
n = n /10;
if(temp==0) {
return 1 + countZeros(n);
}
return countZeros(n);
}
}
public static void main(String ... args) {
System.out.println(countZeros(110110));
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)