Prime Number Print

My prompt for this specific code is as follows, "Prime numbers. Write a program that prompts the user for an integer and then prints out all prime numbers up to that integer. For example, when the user enters 20, the program should print 2 3 5 7 11 13 17 19." I'm having trouble even figuring out how I'd go about starting even a basic structure for this problem. Any clues for a beginner?
It's quite simple.
1. Prompt the user to input a number.
2. Use a for loop from 2 up to this number.
3. Look on the internet for a function to check if a number is a prime.
4. Call this function inside the for loop for each odd number, if is a prime number print it.
from the project euler website by chance? This is a good read and nice algo https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes . There's general pseudo code in there, but should still be a decent exercise in translating ideas into code.
Topic archived. No new replies allowed.