निचे दिया गया program 0 से 19 तक की संख्याओं के लिए यह print करता है कि कौन सी संख्या अभाज्य है और कौन सी नहीं है।
क्या आप इसको आगे बढ़ाते हुए ऐसा program भी लिख सकते हैं जो 20 से 40 तक की अभाज्य संख्या print करे।

#include <stdio.h>
 
int checkPrime(int n) {
 if(n < 2) return 0;
 int i = 2;
 for(i = 2; i<n; i++) {
  if(n%i == 0) return 0;
 }
 return 1;
}
 
int main() {
 int num = 0;
 for(num = 0; num < 20; num++) {
  int isPrime = checkPrime(num);
  if(isPrime == 0) {
   printf("%d is not prime\n", num);
  }
  else if(isPrime == 1) {
   printf("%d is prime\n", num);
  }
 }
}

Output
0 is not prime
1 is not prime
2 is prime
3 is prime
4 is not prime
5 is prime
6 is not prime
7 is prime
8 is not prime
9 is not prime
10 is not prime
11 is prime
12 is not prime
13 is prime
14 is not prime
15 is not prime
16 is not prime
17 is prime
18 is not prime
19 is prime