fork(2) download
  1. #include <stdio.h>
  2.  
  3. int countZeros(int n) {
  4. int count = 0;
  5. while (n % 10 == 0) {
  6. count++;
  7. n /= 10;
  8. }
  9. return count;
  10. }
  11.  
  12. int main(void) {
  13. printf("%d\n", countZeros(123000));
  14. printf("%d\n", countZeros(102030));
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
3
1