Pagini recente » Cod sursa (job #1333790) | Cod sursa (job #261260) | Cod sursa (job #1308392) | Cod sursa (job #1711433) | Cod sursa (job #600410)
Cod sursa(job #600410)
#include <stdio.h>
int main()
{
FILE *f = fopen("fact.in", "r") ;
FILE *g = fopen("fact.out", "w");
if (f == NULL || g == NULL)
{
return -1;
}
int p, count = 1, x = 0,y = 0;
fscanf(f, "%d", &p);
while (count < p)
{
x++;
count++;
if (count < p)
{
y++;
count++;
}
}
if (x == 0) fprintf(g, "%d", 1);
else if (x == y) fprintf(g, "%d", (count-1) * 10);
else fprintf(g, "%d", (count-1) * 5);
fclose(g);
return 0;
}