fork download
  1. using System;
  2.  
  3. public class Test {
  4. public static int ContarZeros(int n) {
  5. int count = 0;
  6. while (n % 10 == 0) {
  7. count++;
  8. n /= 10;
  9. }
  10. return count;
  11. }
  12.  
  13. public static void Main() {
  14. Console.WriteLine(ContarZeros(123000)); // esperado: 3
  15. Console.WriteLine(ContarZeros(102030)); // esperado: 1
  16. }
  17. }
Success #stdin #stdout 0.05s 23920KB
stdin
Standard input is empty
stdout
3
1