Cod sursa(job #2642496)

Utilizator EduardxxxCostache Paul Eduard Eduardxxx Data 15 august 2020 18:03:49
Problema Factorial Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.44 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;

	
	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--;
	}
	 
	fout << nr;

	cin.get();
	return 0;
}