asked in Algebra by anonymous

1 Answer

Hi anonymous.

To find the number of trailing zeros you can use a computer program like the one below adapted  from by following the instructions found here:

// Function to return trailing 0s in factorial of n
// count-trailing-zeroes-factorial-number/
function findTrailingZeros($n) {
// Initialize result
$count = 0;
// according to wiki/Trailing_zero
while(floor($n/$i) >= 1) {
$count += floor($n/$i); $i=$i*5;}
return floor($count);

The code above is written in PHP, but can be translated easely to many other computer languages. 

It was adapted from the code below. I don't remember very well, but there is a issue with the original code shown below.

// C++ program to count trailing 0s in n! 
#include <iostream>
using namespace std;
 // Function to return trailing 0s in factorial of n 
int findTrailingZeros(int n)
 { // Initialize result
int count = 0; 
// Keep dividing n by powers of 5 and update count for (int i=5; n/i>=1; i *= 5)
count += n/i; 
return count;

You can also check this calculator factorial calculator here (click). As you can see, the number of trailing zeros in 70 factorial is 16.

IFactorial Calculator

Click here to access this factorial calculator.

answered by questiun