Cod sursa(job #24413)

Utilizator gangstacornyBugnaru Gelu gangstacorny Data 2 martie 2007 11:45:31
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb

#include <fstream>
#define MAX 10001

using namespace std;

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

int f[MAX];

int main()
{
	int n, fact,i ;

	fin >> n;

	for (i = 2; i <= n; i ++)
	{
		int aux = i;

		fact = 2;

		while ( aux != 1 )
		{
			while ( aux % fact == 0 )
			{
				aux /= fact;

				f[fact] ++;
			}

			fact ++;
		}
	}

	for (i = 2; i <= 1000; i ++)

		if ( f[i] )

			fout << i ;

	

	return 0;
}