Pagini recente » Rating Matei Pisaru (matei2502) | Cod sursa (job #433890) | Cod sursa (job #249725) | Cod sursa (job #2046389) | Cod sursa (job #2550166)
#include <iostream>
#include <fstream>
using namespace std;
int findZeros(int nrOfZeros) {
int comparator = 0;
int i = 0;
if (nrOfZeros == 0) {
return 1;
}
for (int i = 0; i < nrOfZeros; ++i) {
if ((i + 1) % 5 == 0) {
i++;
}
comparator += 5;
}
return comparator;
/*while (comparator < nrOfZeros) {
i += 5;
int aux = i;
while (aux % 5 == 0) {
comparator++;
aux /= 5;
}
}
return i;*/
}
int main() {
ifstream myfile;
myfile.open("fact.in");
ofstream outfile ("fact.out");
int nrOfZeros = 0;
while(myfile >> nrOfZeros) {
outfile << findZeros(nrOfZeros) << '\n';
}
myfile.close();
outfile.close();
return 0;
}