The following code shows how to Compute and Display All Prime Numbers in the Given range in C.

// Find Whether a Number is Prime or Not

#include <stdio.h>

int main()
{
    int low, high, i, j, prime=1;
    printf("Enter the lower value limit of the range: ");
    scanf("%d", &low);
    printf("Enter the higher limit of the range: ");
    scanf("%d", &high);

    for(j=low;j<=high;j++){
        for(i=2;i<=j/2;i++)
       {
          if(j%i==0)
          {
            prime=0;
            break;
          }
       }
      if(prime)
          printf("%d ", j);
      prime=1;
    }
    return 0;
}

Output

Enter the lower value limit of the range: 10
Enter the higher limit of the range: 50
11 13 17 19 23 29 31 37 41 43 47


Further Reading

50+ C Programming Interview Questions and Answers

C Program to Find Factorial of a Number