Cod sursa(job #1804768)

Utilizator botondkozmanKozman Botond botondkozman Data 12 noiembrie 2016 22:38:44
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    long long int P;
    f>>P;
    long long int fact=1, i=1;
    long long int db=0;
    if (P<=0)
        if (P<0) g<<-1;
        else g<<1;

    else {
        while (P!=db)
        {
            fact=fact*i;
            if (fact%10==0)
            {
                db++;
                fact=fact/10;
            }
            i++;
        }
        g<<i-1;
    }
}