Pagini recente » Cod sursa (job #1642130) | Cod sursa (job #2277578) | Cod sursa (job #2203770) | Cod sursa (job #2046486) | Cod sursa (job #2550141)
#include <iostream>
#include <fstream>
using namespace std;
int findZeros(int nrOfZeros) {
int comparator = 0;
int i = 0;
if (nrOfZeros == 0) {
return 1;
}
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;
}