Cod sursa(job #592588)

Utilizator aamarieiAmariei Andrei aamariei Data 29 mai 2011 11:33:06
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.3 kb
#include <iostream.h>
#include <fstream.h>
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
	long p,n=1,fact=1,k=0;
	int ok=1;
	fin>>p;
	while (ok==1)
	{
		fact=fact*n;
		n++;
		while (fact%10==0)
			k++;
		if (k==p) ok=0;
		k=0;
	}
	fout<<n;
	return 0;
	fout.close();
}