How to judge whether a number is a prime in C language
In this article, the editor introduces in detail "how to use C language to judge whether a number is a prime number". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use C language to judge whether a number is a prime number" can help you solve your doubts.
I. introduction of the concept
Prime numbers are also called prime numbers. A natural number greater than 1 (starting from 2) is called a prime number that is not divisible by other natural numbers except 1 and itself, otherwise it is called a composite number.
0 and 1 are neither primes nor composite numbers, and the smallest prime is 2.
II. Code
Method 1:
Bool is_Prime (int num) {int i; for (I = 2bot I)