Pagini recente » Cod sursa (job #626510) | Cod sursa (job #1881173) | Cod sursa (job #1887541) | Cod sursa (job #2405222) | Cod sursa (job #1220349)
#include <iostream>
#include <math.h>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
double p;
f>>p;
double x = 1, f;
while (x != 0)
{
f = 1;
for (int i = 1; i <= x; i ++)
{
f = f * i;
}
g<<f<<"\n";
double y = pow(10, p);
if ((int)floor(f) % (int)floor(y) == 0)
{
g<<x - 1;
x = 0;
}
else
{
x = x + 1;
}
}
return 0;
}