Cod sursa(job #353495)

Utilizator CehashishChis Ovidiu Cehashish Data 5 octombrie 2009 13:13:33
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include<iostream.h>
#include<fstream.h>

ifstream f;
ofstream g;

void facto(unsigned long int n)
 {
	unsigned long int a,b,aux,nr; 
	 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()
 {
	 int m;
	 f.open("fact.in");
	 g.open("fact.out");
	 f>>m;
	 facto(m);
	 f.close();
	 g.close();
	 return 0;
}