how do i calculate prime number

i'm a beginner using C.. i have a project on creating a souce that can detect prime number.
for example
if the user enter :10
they will print out all the prime nummber within 10
which mean it will print out:7,5,3,1.
can anybody give some tips on doing that ?
any help will be appreciate..

1. create a table of numbers, starting with 2
2. take the first element (let's call it "i"), and take out all of its multiples (eg. 2+2, 2+2+2, 2+2+2+2)
3. when you're done, whatever i is is a prime number.

The problem with private concelling is we have no how far you have got and where you are stuck. It is pointless to simply state that you are stuck.

There are several approaches.

You may use the Sieve. The link has a step-by-step explanation of the algorithm, pseudo-code and even an animation to demonstrate how it works. So you should be able to put at least something together that you can show us.

Or you could simply loop from 2 to input (note that 1 is not a prime) and perform the naive primeness test on each value (trial divisions to determine if it is divisible by any value). This approach is not as efficient but it is simpler to code.

I might be wrong.

Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.