Wednesday 30 January 2013

11. Factorial Problem code: FCTRL

#include <stdio.h>
int main()
{
    long long int ans,num,test;
    scanf("%d",&test);

    while(test--)
    {
        scanf("%lld",&num);
        ans=0;
        while(num)
        {
            num/=5;
            ans += num;
        }
        printf("%lld\n",ans);
    }
    return 0;
}

No comments:

Post a Comment