Cod sursa(job #656596)
Utilizator | Data | 4 ianuarie 2012 20:56:05 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<iostream>
#include<fstream>
using namespace std;
std::ifstream f("fact.in");
std::ofstream g("fact.out");
int main(void){
int x=1,i=2,p,j;
f>>p;
bool go=true;
while(go)
{
//imultim
x=x*i;
j=0;
int x2=x;
while(x2%10 == 0)
{
j++;
x2=x2/10;
}
if(j==p)
go=false;
else
i++;
}
g<<i;
return 0;
}