Cod sursa(job #1331722)
| Utilizator | Data | 1 februarie 2015 01:05:32 | |
|---|---|---|---|
| Problema | Factorial | Scor | 35 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream inFile("fact.in");
ofstream outFile("fact.out");
int P;
inFile >> P;
unsigned int multiple_of_5 = 0, temp, counter_of_5 = 0;
if (P == 0)
outFile << 1;
do
{
multiple_of_5 += 5;
temp = multiple_of_5;
while (temp % 5 == 0)
{
counter_of_5++;
temp /= 5;
}
} while (counter_of_5 != P);
outFile << multiple_of_5;
}