Cod sursa(job #1333526)
Utilizator | Data | 3 februarie 2015 11:57:19 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<fstream>
#include<iostream>
#include<conio.h>
using namespace std;
int p;
void main()
{int k=0,zero=1,numar=1,i=1,fact;
ifstream f("factorial.in");
ofstream g("factorial.out");
f>>p;
while(k!=p){zero=zero*10;
k++;
}
while(numar%zero!=0){numar=numar*i;
i++;
if(numar%zero==0)fact=i;
}
fact--;
g<<fact;
f.close();
g.close();
}