Cod sursa(job #1456611)

Utilizator Dragan_Daniela_Liliana_322CCDragan Daniela Dragan_Daniela_Liliana_322CC Data 1 iulie 2015 13:31:34
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <stdio.h>
#include <math.h>

int main()
{
    freopen ("fact.in","r",stdin);
    freopen ("fact.out","w",stdout);

    int n = 1;
    double fact = 1;
    double p;
    scanf("%lf", &p);

    while(1)
    {
        if (fmod(fact,pow(10,p)) == 0)
        {
            printf("\n%d",n);
            break;
        }

        fact = fact * (n+1);
        n++;
    }

    return 0;
}