Cod sursa(job #350167)

Utilizator CehashishChis Ovidiu Cehashish Data 22 septembrie 2009 22:22:59
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include<iostream>
#include<fstream>
using namespace std;

void facto(unsigned long int n)
{
while(n!=0)
{
f>>nr;
a=0;
b=0;
while(b<nr)
 {a=a+5;
  aux=a;
  while(aux!=0)
   {if(aux%5==0)
     b++;
    aux=aux/5;}
  }
if(b==nr) g<<a<<endl;
 else g<<"-1"<<endl;
n--;
}

}
int main()
{
ifstream f;f.open("fact.in");
ofstream g;g.open("fact.out");
unsigned long int m,aux,nr,a,b;
f>>m;
facto(m);
g.close();
f.close();
return 0;
}