Pagini recente » Cod sursa (job #72322) | Cod sursa (job #659158) | Cod sursa (job #2330172) | Cod sursa (job #1194185) | Cod sursa (job #3201138)
#include <stdio.h>
#include <stdint.h>
#include <math.h>
int factor(int x){
if (x == 0) return 1;
else return x * factor(x - 1);
}
int zero_count(int x){
int32_t cnt = 0;
while (x == 0){
if (x % 10 == 0){
cnt++;
x /= 10;
}else break;
}
return cnt;
}
int main(){
int a;
FILE* input;
input = fopen("fact.in", "r");
fscanf(input, "%d", &a);
FILE* output;
output = fopen("fact.out", "w");
for (int i = 0; i < 10 * a; ++i){
if (zero_count(factor(i)) == a){
fprintf(output, "%d", i);
break;
}else continue;
}
fclose(input);
fclose(output);
return 0;
}