Cod sursa(job #214962)

Utilizator mihaio07Oprea Mihai mihaio07 Data 17 octombrie 2008 00:52:26
Problema Factorial Scor 0
Compilator c Status done
Runda Arhiva de probleme Marime 0.58 kb
#include<stdio.h>
//#include<conio.h>
//0 2 4 10
int main()
{
    FILE *in, *out;
    int N=1, P, c2=0, c5=0, k=1;
    in=fopen("fact.in", "r");
    out=fopen("fact.out", "w");
    
    fscanf(in, "%d", &P);
    
    while (c5<P)
        {
            while (N%2==0) 
            {
                N/=2; c2++;
            }
            while (N%5==0)
            {
                N/=5; c5++;
            }
            N++;
        }
    if(!nrz) fprintf(out, "%d", -1);
    else fprintf(out, "%d", N-1);
// getch();
    return 0;
}