Cod sursa(job #34180)
Utilizator | Data | 20 martie 2007 12:26:23 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.28 kb |
#include<fstream.h>
int main()
{
ifstream in("fact.in");
ofstream out("fact.out");
int i=1,n,c2=0,c5=0;
in>>n;
while(n!=0)
{
i++;
if(i%2==0)
c2++;
if(i%5==0)
c5++;
if(((c2==n)&&(c5>=n))||((c5==n)&&(c2>=n)))
{
out<<i;
n=0;
}
}
in.close();
out.close();
return 0;
}