Pagini recente » Cod sursa (job #2433219) | Cod sursa (job #2679154) | Cod sursa (job #1165081) | Cod sursa (job #1796436) | Cod sursa (job #1473112)
/* Author: Raul Vasile
* Mail: [email protected]
*/
#include <stdio.h>
// Rezolvare problema
int solve(int zeros) {
int number = 1;
while (zeros != 0) {
number++;
if (number % 10 == 5) {
zeros--;
if (number % 100 % 25 == 0) {
zeros--;
}
}
if (number % 10 == 0) {
zeros--;
}
}
return number;
}
int main(int argc, char* argv[]) {
// Declarare variable
int zeros;
// Declarare fisiere
FILE *input, *output;
// Deschidere fisiere
input = fopen("fact.in", "r");
output = fopen("fact.out", "w");
// Verificare fisiere
if (input == NULL || output == NULL) {
printf("Error opening files");
return 0;
} else {
fscanf(input, "%d", &zeros);
fprintf(output, "%d\n", solve(zeros));
}
return 0;
}