**Embarcadero Dev-C++**

Embarcadero Dev-C++ is free, and is a fast, portable and simple C/C++ IDE for Windows. The free version is great for beginners. If you want to develop professionally it is highly recommended you start with C++ Builder CE version. Dev-C++ can be downloaded from Dev cpp or from Github. The original author of the software is Bloodshed Software.

Prime numbers are interesting area to research. A **prime number**, it is also called **prime** shortly , is a natural number (a positive integer) greater than 1 that is not a product of two smaller natural numbers. If a number is not prime then it is called as a **composed number**. There are several mathematical questions regarding prime numbers are still unsolved. Finding them and relations and their effects on some other functions, graphics really interesting in mathematical phenomena.

Here is a Dev-C++ Builder example to find number of prime numbers in a given range.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
#include <iostream> #include <stdio.h> #include <math.h> #include <time.h> using namespace std; #define max_n 1000000 //--------------------------------------------------------------------------- bool is_prime(unsigned int x) { if(x<=1) return(false); unsigned int q = floor(sqrt((float)x)); for(unsigned int i=2; i<=q; i++) { if((x%i)==0) return(false); } return(true); } //--------------------------------------------------------------------------- int count_primes(unsigned int maxN) { unsigned int res=0; for(int i=2; i<=maxN; i++) { if(is_prime(i)) res++; } return(res); } //--------------------------------------------------------------------------- int main(int argc, char** argv) { unsigned int count; clock_t start,end; for(int k=0; k<5; k++) { start = clock(); count = count_primes(max_n); end = clock(); cout << "Number of primes between 0 to " << max_n << "= " << count << endl; cout << "Elapsed time:" << end-start << " ms" << endl; } return 0; } |

Output will be as here.