After seeing the topic, analysis, the factorial of 10 is already very big. The calculation of the end of the number of 0, completely unrealistic, even if the implementation is also very troublesome.
Later, when you think of a number in the factorial of the product has 5 end of the number should be at the end of the result of a 0.
Put it into practice, test a few, no mistakes.
Posted out, we look, have a problem in time to advise:
Copy Code code as follows:
/**
* To find the number of n among the 1000~10000 and calculate the number of n! at the end of how many 0?
*/
public static void Test2 (int number) {
int count = NUMBER/5;
System.out.println (count);
}
After reviewing the knowledge of mathematics, the above calculation should be wrong.
It should be written as follows, +1 times per 5 multiples.
Copy Code code as follows:
int x = 10000;
while (x>0)
{
Count = count + x/5;
x = X/5;
}
System.out.println (count);