Cod sursa(job #2155451)
Utilizator | Data | 7 martie 2018 20:53:02 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
int x, nr, div, cz;
in >> nr;
x = cz = 0;
while ( cz < nr ) {
x += 5;
div = x;
while ( div % 5 == 0 ) {
div /= 5;
cz++;
}
}
if ( x == 0 )
out << 1;
else
out << x;
return 0;
}