fork(1) download
  1. class Ideone {
  2. static int countZeros(int n) {
  3. int count = 0;
  4. while (n % 10 == 0) {
  5. count++;
  6. n /= 10;
  7. }
  8. return count;
  9. }
  10. public static void main (String[] args) {
  11. System.out.println(countZeros(123000));
  12. System.out.println(countZeros(102030));
  13. }
  14. }
Success #stdin #stdout 0.11s 320576KB
stdin
Standard input is empty
stdout
3
1