1#include <stdio.h>
2int main()
3{
4 int num1, num2, flag_var, i, j;
5
6 /* Ask user to input the from/to range
7 * like 1 to 100, 10 to 1000 etc.
8 */
9 printf("Enter two range(input integer numbers only):");
10 //Store the range in variables using scanf
11 scanf("%d %d", &num1, &num2);
12
13 //Display prime numbers for input range
14 printf("Prime numbers from %d and %d are:\n", num1, num2);
15 for(i=num1+1; i<num2; ++i)
16 {
17 flag_var=0;
18 for(j=2; j<=i/2; ++j)
19 {
20 if(i%j==0)
21 {
22 flag_var=1;
23 break;
24 }
25 }
26 if(flag_var==0)
27 printf("%d\n",i);
28 }
29 return 0;
30}