Cod sursa(job #1447036)
Utilizator | Data | 3 iunie 2015 14:40:32 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int p,i,n=0,k=0,x;
f>>p;
if(p==0)
g<<"1";
else
{
while(k<p)
{
n=n+5;
x=n;
while(x%5==0)
{
k++;
x=x/5;
}
}}
g<<n;
return 0;
}