Cod sursa(job #828862)

Utilizator RaresGabrielMircea Rares-Gabriel RaresGabriel Data 4 decembrie 2012 16:08:49
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include<iostream>
#include<cmath>
#include<fstream>

using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main () {
     int i,p,k=0,n=0,y;
     fin>>p;
     while(k<p){y=i;
                        while(y%5==0){y=y/5;
                                                  k++;}
                        i=i+5;}
    if(k==p)fout<<i-5;

    fin.close();
    fout.close();

    return 0;
}