Cod sursa(job #349320)

Utilizator CehashishChis Ovidiu Cehashish Data 19 septembrie 2009 00:47:05
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
<iostream.h>

ifstream f;
ofstream g;
f.open("fact.in");
g.open("fact.out");
unsigned long int n,aux,nr,i,a,b;

int fact(int x);

{
b=0;
a=0;
 while (b<x)
   {
    a=a+5;
	aux=a;
	while (aux!=0)
	{ if(aux%5==0) b++;
	   aux=aux/5;}
  if(b==x) return a;
   else return "-1";
      }
}

void main()
{
f>>n;
while(n!=0)
 {
 f>>nr;
 g<<fact(nr);
 n--;
  }