Cod sursa(job #1244976)
| Utilizator | Data | 18 octombrie 2014 14:48:13 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
//============================================================================
// Name : Factotial.cpp
// Author : AndreiFlorescu
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main() {
unsigned long int p,f=1, n = 1;
ifstream file_in("fact.in");
ofstream file_out("fact.out");
file_in >> p;
do
{
f = f*n++;
if(f%10 == 0)
{
f /= 10;
p--;
}
}while(p > 0);
file_out << n-1;
return 0;
}
