Pagini recente » Cod sursa (job #2590995) | Cod sursa (job #3240992) | Cod sursa (job #1096257) | Cod sursa (job #751481) | Cod sursa (job #353495)
Cod sursa(job #353495)
#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;
}