Cod sursa(job #2453154)
| Utilizator | Data | 2 septembrie 2019 17:41:17 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | c-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
unsigned int zero_count(unsigned int n)
{
unsigned int count = 0;
while (n % 10 == 0)
{
n = n / 10;
count++;
}
return count;
}
int main()
{
FILE* f = fopen("fact.in", "rt");
unsigned int n, p=1, i=2;
fscanf(f, "%u", &n);
while (zero_count(p) != n)
{
p = p * i;
i++;
}
f = fopen("fact.out", "wt");
fprintf(f, "%d\n", i-1);
fflush(stdout);
fclose(f);
return 0;
}