Cod sursa(job #537256)

Utilizator jessica26Ileana Stuparu jessica26 Data 20 februarie 2011 15:07:27
Problema Factorial Scor 0
Compilator c Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <stdio.h>
#include <string.h>

int main() {

	int n, p,c, aux, i, sum;
	char *path1 = "C:\\Users\\madi\\workspace\\arena\\data.in";
	char *path2 = "C:\\Users\\madi\\workspace\\arena\\data.out";
	//printf(strcat(path, ".in\n"));
	FILE*f = fopen(path1, "rt");
	fscanf(f, "%d", &p);
	fclose(f);
	n = p * 5;
	c = 25;
	while (c < n){
		aux = (int) (n / c);
		for (i = 1; i <= aux; i++)
			if (i * c <= n)
				n -= 5;
		c = c*5;
	}


	f = fopen(path2, "wt");
	fprintf(f, "%d\n", n);
	fclose(f);

return 0;
}