Cod sursa(job #1501731)

Utilizator OlivianOlivian Dan Cretu Olivian Data 13 octombrie 2015 19:43:11
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<cstdio>
using namespace std;
int main ()
{
    int N=0,p,j,x=1;
    freopen("fact.in","r",stdin);
    freopen("fact.out","w",stdout);
    scanf("%d",&p);
    if(p==0)
    {
        printf("%d",x);
    }
    else
    {
    do
    {
        N=N+5;
        j=N;
        do
        {
            p--;
            j=j/5;
        }while(j%5==0);
    }while(p!=0);
    printf("%d",N);
}
}