Cod sursa(job #1195479)

Utilizator crisana stanescu cris Data 7 iunie 2014 13:31:52
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.29 kb
#include <iostream>
#include <fstream>
using namespace std;
int main()
{int N,P,x;
N=1;
x=0;
ifstream f("fact.in");
ofstream g("fact.out");
f>>P;
while (x<P)
{while (N!=0)
{if (N%5==0) x=x+1;
N=N/5;}
N=N+1;}
if (N-1==P) g<<N-1;
else g<<-1;
f.close();
g.close();
return 0;
}