Cod sursa(job #2642497)

Utilizator EduardxxxCostache Paul Eduard Eduardxxx Data 15 august 2020 18:09:15
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.5 kb
#include<iostream>
#include<fstream>

using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main() {

	int fact=1,nr=1,p,zero,nr_zero=0,fact_cont;
	fin >> p;

	if (p < 0) {
		cout << -1;
		goto aici;
	}

	while (nr_zero!=p) {

		nr++;

		fact *= nr;
		

		fact_cont = fact;

		nr_zero = 0;
		do {
			zero = fact_cont % 10;
			fact_cont /= 10;
			nr_zero++;
		} while (zero==0);
		nr_zero--;
	}
	 
	cout << nr;

	aici:

	cin.get();
	return 0;
}