I\'m currently trying out some questions just to practice my programming skills. ( Not taking it in school or anything yet, self taught ) I came across this problem which re
There are a two approaches to testing for primality you might want to consider:
As for why you code is crashing I suspect changing the line that reads
for( int d=0; d<=b; d++)
to
for( int d=0; d
will fix the problem because you are trying to read from a potentially uninitialized element of the array which probably contains garbage.