Cod sursa(job #1437372)

Utilizator StfnutssJianu Stefanut-Alexandru Stfnutss Data 17 mai 2015 15:54:50
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>
using namespace std;



int main(int argc, char** argv) {
	ofstream g("factorial.out");
	ifstream f("factorial.in");
	int a,i = 0,nr = 0,count = 0,b;
	f>>a;
	while(count<a){
		i = i + 5;
		b = i/5;
		while(b % 5 == 0 && b != 0){
			count++;
			b = b/5;
		}
		count++;
	}
	if(count > a) {
		i = -1;
	}
	g<<i;
	f.close();
	g.close();
	return 0;
}