All pastes #422466 Raw Edit

Donno

public text v1 · immutable
·published 2007-04-03 14:05 UTC
rendered paste body
int main(int argc, char **argv) {
	printf("Calculating Hundreth Prime\n");
	int primeList[1000] = {2};
	int number = 3;
	int count = 1;
	printf("The   1 Prime is 2\n");
	while (count < 1000) {
		bool divis = false;
		for (int x = 0; x <= (count - 2); x++) {
			if (checkIfDivisble(number, primeList[x])) {
				divis = true;
			}
		}
		if (divis == false) {
			count++;
			printf("The %3i Prime is ", count);
			printf("%i\n", number );
			primeList[count-1] = number;
		}
		number++;
	}
	printf("\nThe Hundreth Prime is %i\n", primeList[999]);
}
bool checkIfDivisble(int number, int deno) {
	/*
	This should never happen :)
	if (deno == 0){
	    printf("Your trying to divide by Zero\n");
	    return 0;
	}*/
	int test = number / deno;
	double test2 = number / (double)deno;
	if ((double)test == test2) {
		return true;
	} else {
		return false;
	}
}