C++ Prime Numbers

#include <stdio.h>
#include <time.h>

using namespace std;

bool isPrime(long n)
{
	long i, m;
	m = n / 2;
	if(n % 2==0)
		return false;
	else for(i=3; i<m; i+=2)
		if(n % i==0)
			return false;
	return true;
}

int main()
{
	long j;
	clock_t tStart = clock();
	for(j=1;j<1000000;j++)
		if(isPrime(j))
			printf("%ld\n", j);
	printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
	return 0;
}