Cod sursa(job #548297)

Utilizator CehashishChis Ovidiu Cehashish Data 7 martie 2011 12:18:26
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include<iostream.h> 
#include<fstream.h> 

 
ifstream f; 
ofstream g; 
unsigned long int a,b,aux;  
 
void facto(unsigned long int n) 
{
	
g.open("fact.out"); 
while(b<n) 
{
a=a+5; 
aux=a; 
while(aux!=0) 
  { 
if(aux%5==0) 
b++; 
aux=aux/5; 
  } 
} 
 
if(b==n) g<<a<<endl; 
else g<<"-1"<<endl; 
//n--; 
} 

 
int main() 

{ 
unsigned long int m; 
f.open("fact.in"); 
f>>m; 
facto(m); 
f.close(); 
g.close();
return 0; 
}