#include<stdio.h>
 int main()
 {
   int i, prime,upper,lower, n;
   printf(" ENTER THE LOWER LIMIT : ");
   scanf("%d", &lower);
   printf("\n ENTER THE UPPER LIMIT : ");
   scanf("%d", &upper);
   printf("\n PRIME NUMBERS LIST IS : ");
   for(n=lower+1; n<upper; n++)
   {
     prime = 1;
     for(i=2; i<n/2; i++)
       if(n%i == 0)
       {
         prime = 0;
         break;
       }
     if(prime)
       printf("\t%d", n);
   }
 }

 

OUTPUT:

 ENTER THE LOWER LIMIT : 10

 ENTER THE UPPER LIMIT : 100

 PRIME NUMBERS LIST IS :        11      13      17      19      23      29

31      37      41      43      47      53      59      61      67      71

73      79      83      89      97

This Program Reduces the number of iterations in the for loop.

General Program to find PRIME NUMBERS : C program to find the PRIME Numbers