Finding the number of trailing zeros in N!
A simple example of finding trailing zeros in the factorial of N.
public int TrailingZeroes(int n) {
int result = 0;
while(n!=0){
result += n/5;
n = n/5;
}
return result;
}
Comments (0)
No comments yet.