Cod sursa(job #1516508)

Utilizator dragos231456Neghina Dragos dragos231456 Data 3 noiembrie 2015 09:10:27
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    int p,n,t,s;
    ifstream f("fact.in");
    ofstream g("fact.out");
    f>>p;
    n=1;
    while(t!=p)
    {
        t=0;
        s=1;
        for(int i=1;i<=n;i++)
        {
            s*=i;
        }
        while(s%10==0)
        {
            t=t+1;
            s/=10;
        }
        n+=1;
    }
    g<<n-1;
}