1. You organize a loop in a given range.
2. You check the loop variable if it is divisible without a rest with a smaller number except the 1. For this you can create a second loop in the range from 2 up to the loop 1 variable.
3. If no this is a prime number, which can be added to a result array.
4. You sort the result array.
5. You print the items of this array.