fork download
  1. class Main {
  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. }
  15.  
  16. //https://pt.stackoverflow.com/q/112972/101
Success #stdin #stdout 0.06s 32304KB
stdin
Standard input is empty
stdout
3
1