Try some nested for loops, run through each of the numbers between 2 and n, dividing each number from 2 to the current number using % division, have a local variable(in the outer loop) set to 0 increment it every time the remainder is 0, if the interior loop completes and the variable is zero, it's a prime number. I think you can figure out how to display each number.
__________________
Apathy: The best outlook this side of I don't give a damn.
|