Cod sursa(job #2211963)

Utilizator iramIoana Popa iram Data 12 iunie 2018 17:17:42
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <fstream>
#include <iostream>

using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main()
{
    int n,p,cop,f5;
    fin>>p;

    n=5;
    f5=0;
    while (1)
    {
        cop=n;
        while (cop%5==0&& cop>1)
        {
            f5++;
            cop/=5;
            if (f5==p)
            {
                fout<<n;
                cout<<n;
                return 0;
            }
        }


        n+=5;
    }

}