Knowledge point:
Pointer used
Algorithm: except 1 and itself, if all numbers in the middle cannot be divisible by itself, this number is a prime number.
Content: obtain all prime numbers (prime numbers) between 2)
Input description:
None
Output description:
One prime number in a row
# Include <stdio. h> int main () {int I, a [100], * P, J, M; P = A; for (I = 2; I <= 100; I ++) {P = A; For (j = 2; j <I; j ++, P ++) // each I, each number J from 2 to I-1 is divided by I, and the remainder is stored in the array {* P = I % J;} p = A; // re-pointing to a [0] (; P <A + I-2; P ++) // The number of arrays is the number between 2 and I, so-2 {If (* P! = 0) // check whether the remainder has 0 {m = 0;} else // check whether the remainder is 0. If it jumps out, it does not meet M! = 1, do not output {M = 1; break;} If (M! = 1) {printf ("% d \ n", I) ;}} return 0 ;}
(Syntax) obtain all prime numbers (prime numbers) between 2 and)