I want to find the formula for calculating the number of trailing zeroes in a given number.
There are certain points that must be factored in the calculation of the number of trailing zeroes. They are:
- Only trailing zeroes before the decimal point are considered in the calculation.
- In case there are no trailing zeroes in the number then the count is 0.
- The numbers are positive and will range from 1 to n
- n = 53000 --> number of zeroes are 3
- n = 9000.201 --> number of zeroes are 3
- n = 41333.00 --> number of zeroes is 0
- n = 200.00 --> number of zeroes are 2
To factor in the decimal scenario, I can do an integer division and then find the number of zeroes. But the issue is what is a good mathematical formula to calculate it directly.
EDIT: I wanted to avoid any iterative approach to find the number of trailing zeroes.