By Aalok Kumar
Hello buddies, here is a c++ program for printing all prime numbers between two numbers.
In my program, the first line of input asks for a (start of interval).
The second line of output asks for b (end of interval).
For each number i between a and b, the program checks that the number i is prime or not.
If found prime then it prints the number.
Note: While traversing, skipping even numbers is better as even numbers are not prime(except 2).
Here is the sample output of my program:
Enter the start of the interval: 20 Enter the end of the interval: 95 Output: 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89
Submitted by Aalok Kumar (Aaloks766626)
Download packets of source code on Coders Packet
Comments