Pagini recente » Cod sursa (job #999755) | Cod sursa (job #2707456) | Cod sursa (job #1000963) | Cod sursa (job #1479130) | Cod sursa (job #2453172)
#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)%10000000000000;
i++;
printf("%llu \n", p);
}
f = fopen("fact.out", "wt");
fprintf(f, "%llu \n", i-1);
fflush(stdout);
fclose(f);
system("pause");
return 0;
}