【牛客网】末尾0的个数
1.题目描述
输入一个正整数n,求n!(即阶乘)末尾有多少个0? 比如: n = 10; n! = 3628800,所以答案为2
2.代码
int main() { int n; scanf("%d",&n); int count = 0; while(n){ count += n/5; n /= 5; } printf("%d",count); return 0; }
题目链接:https://www.nowcoder.com/questionTerminal/6ffdd7e4197c403e88c6a8aa3e7a332a