C program to find the prime numbers between any two Intervals

C program to find the prime numbers between any two Intervals

This page has a C program to find prime numbers between any two Intervals. Prime numbers are Integer numbers which can not be divided by any other integer numbers except one (1) and the number itself.  Few examples of prime numbers are 2, 3, 5, 7, 11, 13 17, etc. The below given C program is used to list (print or display) prime numbers between any two Intervals. Kindly check out the program to find the prime numbers between any two Intervals. The questions to find the prime numbers between any two Intervals can be asked as,

1). C program to find the prime numbers between two Intervals
2). C Program to print the prime numbers between any two Intervals
3). C Program to display the prime numbers between any two Intervals

4). Print prime numbers between any two Intervals

5). C program to list the prime numbers between any two Intervals

6). C program to find and display the prime numbers between two Intervals


Prime numbers between any two Intervals:

   #include<stdio.h>
   int main(){
                 int n, numbr1, numbr2, k, remark;
                 printf("\n Enter any two Numbers : ");
                 scanf("%d %d",&numbr1,&numbr2);
                 printf("\n\n The Prime Numbers between the given Two Intervals are . . . \n ");
                 for(n=numbr1; n<=numbr2; ++n)
                 {
                  remark=0;
                  for(k=2;k<=n/2;k++){
                  if((n % k) == 0){
                  remark++;
                  break;
                  }
                  }
                  if(remark==0)
                  printf("\n %d ", n);
                  }
                  getch();
   return 0;
   }


Sample Outputs:

Enter any two Numbers : 10   20
The Prime Numbers between the given Two Intervals are . . .

11
13
17
19


Related Popular Posts:

Other Related C Programs :


* C Program to find whether the given number is Odd or Even

* C Program to find the Sum of Odd Digits

* C Program to find the Sum of Even Digits

* C Program to find the Sum of Even and Odd Digits,

* C Program to Display Odd digits

* C Program to Display even digits

* C Program to Display Odd Numbers,

* C Program to Display Even Numbers,

* C Program to Check whether the given number is Armstrong number

* C Program to display the Armstrong numbers in Range

* C Program to display the Armstrong numbers between 1 and 1000

* C Program to check perfect number, perfect numbers in range

* C Program to Check Prime number, Prime numbers between 1 and 100

* C Program to display the Prime numbers in a Range

* C Program to display the Sum of Prime numbers

* C Program to Check Strong number

* C Program to display the Strong number in Range

* C Program to Check whether the given number is polindrome number or not

* C Program to Check polindrome number using for loop

* C Program to Check polindrome number using Recursion

* C Program to  check whether the given string is polindrome or not

* C Program to find the Roots of Quadratic equation

* C Program to display Fibonacci Series

* C Program to display the Fibonacci Series using an array

* C Program to display the Fibonacci Series using while loop

* C Program to find the Sum of Fibonacci Series, Factorial of Number

* C Program to find the Factorial without using Recursion

* C Program to find the Factorial using Pointers

* C Program to find the Factorial using Function

Bookmark and Share