Cod sursa(job #2672915)

Utilizator tact1m4n3Dicu Tudor Andrei tact1m4n3 Data 15 noiembrie 2020 14:24:11
Problema Ciurul lui Eratosthenes Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.29 kb
#include <iostream>
#include <fstream>

std::ifstream infile("ciur.in");
std::ofstream outfile("ciur.out");

bool prim(int n)
{
	int d = 2;
	while (d * d <= n)
	{
		if (n % d == 0)
			return false;
	}

	return true;
}

int main()
{
	int n;
	infile >> n;
	outfile << prim(n);
}