To keep it simple:
Write a main loop that goes through all the numbers, starting with 2, and incrementing one at a time. Determine whether each number is a Prime number. If it is, increment a counter.
To determine whether each number is a prime number, either use an inner loop, or a separate function. Test divisibility of the number "n" by every number from 2 to n-1. If you find a factor, then it is not a prime number.
Note that you can test divisibility by using the "%" operator. For example:
if (number % factor == 0)
// number is divisible by factor
else
// it isn't
Copyright © 2026 eLLeNow.com All Rights Reserved.