Cod sursa(job #1666803)

Utilizator mateescudragosMateescu Dragos mateescudragos Data 28 martie 2016 13:24:04
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.67 kb
// test1.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include "stdio.h"
#include "fstream"
#include "iostream"
#include "string"

using namespace std;

void citire(int* x)
{
	ifstream myfile;
	myfile.open("fact.in");
	myfile >> *x;
	myfile.close();
}

void scriere(int x)
{
	ofstream outfile;
	outfile.open("fact.out");
	outfile << x;
	outfile.close();
}



void main()
{
	int p;
	int m2=0, m5=0, m10=0,i=1;

	citire(&p);
	while(m10<p)
	{
		i++;
		if (i%2==-0) {
			m2++;
		}
		if ((i%5)==0) {
			m5++;
		}
		if ((m2>=1)&&(m5>=1)){
			m10++;
			m2=0;
			m5=0;
		};

	};
	scriere(i);
}