answersLogoWhite

0

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

User Avatar

Wiki User

11y ago

Still curious? Ask our experts.

Chat with our AI personalities

RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

Add your answer:

Earn +20 pts
Q: How do you find the 12th prime number using c?
Write your answer...
Submit
Still have questions?
magnify glass
imp