C语言编写程序计算1000!的某尾有多少个零

C语言: 编写程序计算1000!的某尾有多少个零。

#include <stdio.h>
int main()
{
    
    
	int i,k,m;
	for(k=0, i=5; i<=1000; i+=5)
	{
    
    
		m=i;
		while(m%5 == 0)
		{
    
    
			k++;
			m=m/5;
		}
	}
	printf("%d\n",k);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_35843514/article/details/109194293
今日推荐