Pagini recente » Cod sursa (job #224825) | Cod sursa (job #1305830) | Cod sursa (job #2964766) | Cod sursa (job #2701724) | Cod sursa (job #2453171)
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
unsigned long long zero_count(unsigned long long n, unsigned long long i)
{
unsigned long long count = 0;
while (n % 10 == 0)
{
n = n / 10;
count++;
}
return count;
}
int main()
{
FILE* f = fopen("fact.in", "rt");
unsigned long long n, p=1, i=2;
fscanf(f, "%llu", &n);
while (zero_count(p, i) != n)
{
p = (p * i)%1000000000000000;
i++;
printf("%llu \n", p);
}
f = fopen("fact.out", "wt");
fprintf(f, "%llu \n", i-1);
fflush(stdout);
fclose(f);
system("pause");
return 0;
}