i found a set of beginner's problems to solve...i came up with a solution to this one:

print out all the prime pairs (prime numbers that differ only by 2) from 3 - 10,000.

Code:#include <stdio.h> #include <stdlib.h> main(){ int this_number, divisor, not_prime; int array[1500]; int position = 0; this_number = 3; while(this_number < 10000){ divisor = this_number / 2; not_prime = 0; while(divisor > 1){ if(this_number % divisor == 0){ not_prime = 1; divisor = 0; } else divisor = divisor-1; } if(not_prime == 0) { array[position] = this_number; position = position + 1; } this_number = this_number + 1; } position = 0; while (position < 1500) { if ((array[(position + 1)] - array[position]) == 2) { printf ("%d and %d are prime pairs.\n", array[position], array[(position + 1)]); } position = position + 1; } getchar(); exit(EXIT_SUCCESS); }

anybody have any ideas how i could more 'correctly' do this? for instance...i chose 1500 as the array size to ensure it would be big enough. could i implement some sort of counter that holds the number of primes found, and then automatically set the array size to that value?