Cod sursa(job #1114253)

Utilizator andradamarianMarian Andrada andradamarian Data 21 februarie 2014 14:05:38
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <fstream>

using namespace std;
int zero (int n)
{
    int x , c=0,y;
    for(x=5;x<=n;x++)
    { y=x;
        while(y%5==0)
        {
            c++;
            y=y/5;
        }
    }
    return c;
}
int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    int n=1,p;
    f>>p;
    while(p!=zero(n))
    {
        n=n+1;
    }
    g<<n;

    return 0;
}