Cod sursa(job #2285320)

Utilizator Xutzu358Ignat Alex Xutzu358 Data 18 noiembrie 2018 14:19:47
Problema Factorial Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int k,num,fact=0,cfact;
int main()
{
    f >> k;
    if (k==0)
        g << 1;
else {
    while (num!=k) {
            fact+=5;
            cfact=fact;
        while (cfact%5==0) {
               num++;
               cfact/=5;
        }
    }
    g << fact;
}
    return 0;
}