+ 1
Check the prime number using for ?
To find all the prime numbers to a given number. Prime number ? What is code ?
2 Respostas
0
What exactly are you asking?
If you’re asking what a prime number is, it’s any integer greater than 1 which is divisible only by one and itself. There are infinite prime numbers beginning with: 2, 3, 5, 7, 11, 13, 17, 19, 23…
One simple algorithm for finding all primes less than n is the Sieve of Eratosthenes. My implementation here is in C, but you can find more information on Wikipedia if you don’t have experience with C—the algorithm is famous.
https://code.sololearn.com/cxCZ368BeI0J/?ref=app
0
Hint: use Modulo operator.
Workout your brain!