Cod sursa(job #2188387)

Utilizator raulsomesanRaul Somesan raulsomesan Data 27 martie 2018 09:26:02
Problema Factorial Scor 0
Compilator cpp Status done
Runda bpc9 Marime 0.57 kb
#include <iostream>
#include <fstream>
using namespace std;
int fact(int n)
{
    int p=1;
    for(int i=1;i<=n;++i)
        p=p*i;
    return p;
}
int main()
{
    ifstream fin("fact.in");
    ofstream fout("fact.out");
    int p;
    fin>>p;
    int gasit=0, n=1;
    while(gasti==0)
    {
        int k=0;
        while(n%10==0)
            ++k;
        if(k==p)
        {
            fout<<n;
            gasit=1;
        }
        else if(k>p)
        {
            fout<<"-1";
            gasit=1;
        }
        else
            ++n;
    }
}