Cod sursa(job #1495361)

Utilizator david12345Rotari David david12345 Data 2 octombrie 2015 23:17:39
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include<fstream>
using namespace std;
int factorial(int n){
	if(n==0) return 1;
	else return factorial(n-1)*n;
}
int main(){
	int p,e=1,j=1;
	ifstream fi("fact.in");
	ofstream fo("fact.out");
	fi>>p;
	if(p==0) fo<<1; else{
	
	for(int i=1;i<=p;i++){
	e*=10;	
	}
	while(factorial(j)%e!=0){j++;
	}
	fo<<j;}
	fi.close();
	fo.close();
	return 0;




}