Prime numbers assignment

From WLCS
Revision as of 13:41, 26 September 2013 by Admin (talk | contribs)

Objective:

  • To become well-learned in the way of the while loop

Resources:

Directions:

  1. Prompt the user to enter a number, N
  2. Create a variable named isPrime and set it to True
  3. Use a loop that counts from 2 up to N/2
    • If N is divisible by the loop counter, then set isPrime to False
  4. After the loop, check if isPrime is True,
    1. print out that it is a prime number,
    2. else, print out that it is not a prime number

Additional Challenges:

  1. Prompt the user for N
  2. Print out the first N prime numbers