/*Name: Muhammad Azri bin Jasni @ Abdul Rani
**http://projecteuler.net/problem=7
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?*/
/*
http://fahad-cprogramming.blogspot.com/2012/01/find-prime-number-in-c.html
if count == max, break
if prime count++, num++
*/
#include <iostream>
using namespace std;
bool isPrime(long long);
int main()
{
long long max=0, num, count;
cout << "Max?:" ;
cin >> max;
for (num=2, count=0; count<max; num++)
{
if (isPrime(num))
{
cout << num << " ";
count++;
}
}
cout << endl;
num--;
cout << "Num:" << num;
return 0;
}
bool isPrime(long long number)
{
int count=0;
for (int a=1;a<=number;a++)
{
if (number%a==0)
{
count++;
}
}
if (count==2)
{
return true;
}
else
{
return false;
}
}