Pagini recente » Cod sursa (job #312669) | Cod sursa (job #547315) | Cod sursa (job #700258) | Cod sursa (job #1013850) | Cod sursa (job #2642499)
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main() {
int fact=1,nr=1,p,zero,nr_zero=0,fact_cont;
fin >> p;
if (p < 0) {
cout << -1;
goto aici;
}
while (nr_zero!=p) {
nr++;
fact *= nr;
fact_cont = fact;
nr_zero = 0;
do {
zero = fact_cont % 10;
fact_cont /= 10;
nr_zero++;
} while (zero==0);
nr_zero--;
}
fout << nr;
aici:
cin.get();
return 0;
}