CJCoding With Joseph
15free / daySign inCreate account

Primes In A List

Five whole numbers are read into a list. Print only the prime ones, each on its own line and in their original order. This is the second half of a matching pair with the evens question: the outer for loop has the same shape, but the test for one candidate is itself a loop. Start a divisor at 2 and use an inner while loop that runs while the divisor is below the candidate, clearing a flag whenever the remainder operator % gives 0 for that divisor; a candidate below 2 is never prime. Input: five integers, one per line, no prompts.

Expected Output:

7
13
2

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
LoopsPractice Problems
📥 Auto-Input:
7\n10\n13\n1\n2\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.